When using a template literals to create a string that contains an expression (${something}) the parser reports an error:
class Bar {
foo () {
[1, 2, 3].forEach((a) => {
const valid = `\${${a}}`;
const variable = '123'; // this is highlighted in red as broken
// in valid, the second '{' and 'a' and the second '}' and the second '`' are also highlighted in red as broken
});
}
}
I put the second comment after valid, because when adding that comment on the line of valid, the error does not spill into the line with variable anymore.
When using a template literals to create a string that contains an expression (
${something}
) the parser reports an error:I put the second comment after valid, because when adding that comment on the line of valid, the error does not spill into the line with variable anymore.