Reputation: 15292
I am trying the simple code below, but it is throwing the following error
'let block' is only available in Mozilla JavaScript extensions (use moz option)
let (a=20,b,c) {
console.log(a,b,c);
}
What is the reason for this error?
Upvotes: 0
Views: 748
Reputation: 95315
That syntax is not ECMAScript-6. The standard use of let
would look like this:
{
let a=20, b, c;
console.log(a,b,c);
}
So whatever that syntax is, it's apparently a Mozilla extension available only when writing Mozilla-specific code.
Upvotes: 2
Reputation: 222750
let block is non-standardized and specific to Gecko (it has been also deprecated and removed).
JSHint requires to enable Gecko-only features with moz
option.
The standard way to do this is
{
let a=20,b,c;
console.log(a,b,c);
}
Upvotes: 4