Reputation: 76436
Reading the second chapter of Kyle Simpson's ES6 & Beyond book I see an example for a let block:
let (a = 2, b, c) {
// ..
}
yet, if I execute this in my browser, it throws the error of
Uncaught SyntaxError: Unexpected token {
It does not work even in https://babeljs.io
So, this syntax was not yet implemented. My question is as follows: can I achieve this syntax or something very similar to it?
Upvotes: 1
Views: 62
Reputation: 85767
The (non-standard) syntax you're referring to was implemented in JavaScript 1.7, which shipped with Firefox 2.0.
Version 44 of Firefox removed this syntax to make the implementation of let
and const
compliant with ES6 (bug tracker). Before that these extensions had been deprecated since Firefox 36.
Workaround:
{
let a = 2, b, c;
// ..
}
Upvotes: 3