NOTE: This question was asked from the viewpoint of ECMAScript version 3 or 5. The answers might become outdated with the introduction of new features in the release of ECMAScript 6.   What exactly is the function of the var keyword in JavaScrip...
I was looking at some snippets of code, and I found multiple elements calling a function over a node list with a forEach applied to an empty array.  For example I have something like:  [].forEach.call( document.querySelectorAll('a'), functi...
This question already has answers here:...
I understand that every function in JavaScript is a first-class object and it has an internal property [[scope]] which hosts the binding records of the function's free variables. However, there are two special cases.   Is the function created b...
I'm wondering what is the difference between let and const in ES6. Both of them are block scoped, as the example in the following code:  const PI = 3.14; console.log(PI);  PI = 3; console.log(PI);  const PI = 4; console.log(PI);  var PI = 5; co...
I am not asking if this is okay:  Object.prototype.method = function(){};   This is deemed evil by pretty much everyone, considering it messes up for(var i in obj).  The Real Question  Ignoring   Incompetent browsers(browsers that don't support...
Why are objects not iterable by default?  I see questions all the time related to iterating objects, the common solution being to iterate over an object's properties and accessing the values within an object that way. This seems so common that...
I'm seeing posts about a 'new' Object.create that makes enumeration configurable.  However, it relies on a Object.defineProperty method.  I can't find a cross browser implementation for this method.    Are we stuck writing for the o...
Why are Octal numeric literals not allowed in JavaScript strict mode? What is the harm?    "use strict"; var x = 010; //Uncaught SyntaxError: Octal literals are not allowed in strict mode. <h1>Check browser console for errors</h1>...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.