[quickjs-devel] "SyntaxError: variable name expected" for template strings in destructuring lists

  • From: John Gardner <gardnerjohng@xxxxxxxxx>
  • To: quickjs-devel@xxxxxxxxxxxxx
  • Date: Mon, 25 May 2020 19:02:20 +1000

The following code runs in QuickJS:

let bar = "Bar";
const {
    foo = bar + "baz",
} = {};


However, this does not:

let bar = "Bar";
const {
    foo = `${bar}baz`,
} = {};


Output:

SyntaxError: variable name expected
    at test.mjs:4

Other related posts:

  • » [quickjs-devel] "SyntaxError: variable name expected" for template strings in destructuring lists - John Gardner