Question
I’m getting Hello, my name is ${this.name}
instead of my name. What’s wrong? Am I using this
incorrectly?
Answer
In order to interpolate the name
key into the string, we need to use proper ES6 template literal syntax here. The ${myVariable}
syntax doesn’t work without using backticks (`
) to start and end the string, instead of quotation marks or single quotes.