Search code examples
javascriptecmascript-6mozilla

'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?


Solution

  • 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);
    }