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 and how does ([![]]+[][[]])[+!+[]+[+[]]] evaluate to the letter “i”? [duplicate]

Your cryptic part isn’t all that cryptic if you rewrite it a little: [][”] [] will be coerced into a string because it isn’t an integer, so you’re looking for a property of [] with the name ” (an empty string). You’ll just get undefined, as there is no property with that name. As for … Read more

Why are Objects not Iterable in JavaScript?

I’ll give this a try. Note that I’m not affiliated with ECMA and have no visibility into their decision-making process, so I cannot definitively say why they have or have not done anything. However, I’ll state my assumptions and take my best shot. 1. Why add a for…of construct in the first place? JavaScript already … Read more

What is the difference between ‘let’ and ‘const’ ECMAScript 2015 (ES6)?

The difference between let and const is that once you bind a value/object to a variable using const, you can’t reassign to that variable. In other words Example: const something = {}; something = 10; // Error. let somethingElse = {}; somethingElse = 1000; // This is fine. The question details claim that this is … Read more

Why do catch clauses have their own lexical environment?

Yes, catch clauses indeed have their own Lexical Environments. Check out what happens when it is evaluated: It creates a new one (deriving from the current one) and binds the exception-identifier to it. When executing the catch block, the current Execution Context’s LexicalEnvironment is switched to the new one, while the VariableEnvironment(“whose environment record holds … Read more

tech