I started to work with Angular for a work-related project and am following this tutorial https://www.youtube.com/watch?v=2OHbjep_WjQ&t=1874s (minute 50:30)
Which led me to following code-snippet
i=0;
doSomeHeavyTask()
{
console.log('Called ${this.i++} times');
}
The browser should print following message into the console:
Called 0 times
Called 1 times
...
But VSCode doesnt recognize
${this.i++}
as an JS-expression, therefore it prints just the plain text. The syntax also doesn't get highlighted and is handled like a normal string.
I can't find the reason behind this behaviour and couldn't find any other person with that problem. I would be happy if somebody could come up with a suggestion or a solution :)
console.log(`Called ${this.i++} times`);. Wrap the template literals with backticks (`) and not quotes.