What is the scope of variables in javascript? Do they have the same scope inside as opposed to outside a function? Or does it even matter? Also, where are the variables stored if they are defined globally?...
What is the difference between using call and apply to invoke a function?  var func = function() {   alert('hello!'); };   func.apply(); vs func.call();  Are there performance differences between the two aforementioned methods? When is it b...
I have a function callWithMagic which takes a callback function as a parameter and calls it with one argument.  const callWithMagic = callback => {   const magic = getMagic();   callback(magic); };   I also have a function processMagic which tak...
I recently updated jQuery from 1.8 to 2.1. I suddenly discovered that the .live() stops working. I get the error TypeError: $(...).live is not a function.  Is there any method I can use in place of .live()?...
What is the simplest/cleanest way to implement singleton pattern in JavaScript?...
Is there a way to retain the name of a destructured function argument? I.e., the name of the root object?  In ES5, I might do this (using inheritance as a metaphor to make the point):  // ES5: var setupParentClass5 = function(options) {     textEdi...
My colleague has been using "new function()" with a lower case "f" to define new objects in JavaScript.  It seems to work well in all major browsers and it also seems to be fairly effective at hiding private variables.  Here's a...
For example;  var s = "function test(){   alert(1); }";  var fnc = aMethod(s);   If this is the string, I want a function that's called fnc. And fnc(); pops alert screen.  eval("alert(1);") doesnt solve my problem....
I am using PHP and JavaScript. My JavaScript code contains a function, get_data():  function get_Data(){     var name;     var job;     .....      return buffer; }   Now I have PHP code with the following.  <?php     $i=0;     $buffer_data;...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.