What are the exact circumstances for which a return statement in Javascript can return a value other than this when a constructor is invoked using the new keyword?  Example:  function Foo () {   return something; }  var foo = new Foo ();   If I'...
The following JavaScript code is very confusing to me. Could anyone help me understand. Why does PersonY not have prototype property.  PersonX = function(){}; PersonY = new function(){}; alert(PersonX.prototype); alert(PersonY.prototype);     ?...
Please help me to understand why the following code works:  <script>     var re = RegExp('\\ba\\b') ;     alert(re.test('a')) ;     alert(re.test('ab')) ; </script>   In the first line there is no new operator....
I am curious as what else the new keyword does in the background apart from changing what the this scope refers too.  For example if we compare using the new keyword to make a function set properties and methods on an object to just making a function...
Here's the problem, which only occurs in Internet Explorer (IE).  I have a page that has links to several different types of files.  Links from these files execute a Javascript function that opens a new window and loads the specific file.  This w...
In the middle of Mozilla documentation page it switches (without clear enough explanation) examples from  WorkerBee.prototype = Object.create(Employee.prototype);   to   WorkerBee.prototype = new Employee;   Second form new Employee will initialize p...
I'm using Single File Photo Gallery and want to make one mod to the script... Currently the images open in a new pop up window when left-clicked. If you right click on the image thumb it allows the option for "Open Link" but not "Open...
I'm working on a plug-in for jQuery and I'm getting this JSLint error:  Problem at line 80 character 45: Do not use 'new' for side effects.  (new jQuery.fasterTrim(this, options));   I haven't had much luck finding info on this JS...
I understand the difference in behavior. Date() returns a String representing the current date, and new Date() returns an instance of the Date object whose methods I can call.  But I don't know why. JavaScript is prototyped, so Date is a function...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.