with + let

Francisco Tolmasky tolmasky at gmail.com
Fri Feb 5 18:21:14 UTC 2016


Just curious how the following code should behave:

```javascript
var a = { x: 10 };
with (a)
{
   let x = 20;
}

console.log(a.x);
```

a.x is still 10 in a repl I tried. However, if it was var x in the with x
would be 20. Is let not affecting the with expected behavior?

-- 
Francisco Tolmasky
www.tolmasky.com
tolmasky at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20160205/64b740f2/attachment.html>


More information about the es-discuss mailing list