Examples

Use in with environments

The following code works fine in ES5 and below. However, in ECMAScript 2015 and later, the Array.prototype.keys() method was introduced. That means that inside with environments, "keys" would now be the method and not the variable. This is where now the built-in @@unscopablesArray.prototype[@@unscopables] symbol property comes into play and prevents that some of the Array methods are being scoped into the with statement.