What’s a valid left-hand-side expression in JavaScript grammar?

To concisely answer your question, everything beneath the LeftHandSideExpression production is a valid LeftHandSideExpression. I think the question you are really asking is: What is a valid LeftHandSideExpression and also assignable? The answer to that is anything that resolves to a Reference which is a well defined concept in the specification. In your example new … Read more

Can I disable ECMAscript strict mode for specific functions?

No, you can’t disable strict mode per function. It’s important to understand that strict mode works lexically; meaning — it affects function declaration, not execution. Any function declared within strict code becomes a strict function itself. But not any function called from within strict code is necessarily strict: (function(sloppy) { “use strict”; function strict() { … Read more

Object.defineProperty in ES5?

There are several things that you can’t emulate from the ECMAScript 5 Object.create method on an ECMAScript 3 environment. As you saw, the properties argument will give you problems since in E3-based implementations there is no way to change the property attributes. The Object.defineProperty method as @Raynos mentioned, works on IE8, but partially, it can … Read more

Why was the arguments.callee.caller property deprecated in JavaScript?

Early versions of JavaScript did not allow named function expressions, and because of that we could not make a recursive function expression: // This snippet will work: function factorial(n) { return (!(n>1))? 1 : factorial(n-1)*n; } [1,2,3,4,5].map(factorial); // But this snippet will not: [1,2,3,4,5].map(function(n) { return (!(n>1))? 1 : /* what goes here? */ (n-1)*n; … Read more