I've read some code (seems ES6) from some JavaScript/Node.js
project, and I am confused with the syntax:
var c = `
export const imports = () => {
const mods = []
${files.map((v) => `
['1234', 333]
`)}
return Promise.all(mods)
}
export default imports
`
This will give me
> c
'\n export const imports = () => {\n const mods = []\n \n[\'1234\', 333]\n,\n[\'1234\', 333]\n\n return Promise.all(mods)\n }\n export default imports\n '
if run in Node.js.
I've guessed this is an multiline string, and I tried this:
var s = `
some multiline
indented string`
['1234', 333]
`another multiline
indented string
`
but I got three clauses:
> var s = `
... some multiline
... indented string`
undefined
> ['1234', 333]
[ '1234', 333 ]
> `another multiline
... indented string
... `
'another multiline\n indented string\n '
Anyone can help me with the syntax? Which ECMAScript spec does it use? Hopefully someone can give me the link of the specific spec anchor.