RIYAJ KHAN
RIYAJ KHAN

Reputation: 15292

'let block' is only available in Mozilla JavaScript extensions (use moz option)

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

Answers (2)

Mark Reed
Mark Reed

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

Estus Flask
Estus Flask

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

Related Questions