Variables String Interpolation 2


#1

let myName =‘regional’
let myCity = ‘maine’
console.log(‘My name is ${myName} My favorite city is ${myCity}.’)

I’m stuck on this lesson, can someone explain this lesson? I will continue my own study, thank you.


#2

Hi @regionalroots,

String interpolation in ES6 is done using backtick syntax, which is this ` symbol.

So wrap the text My name is ${myName} ...... with backticks instead of quotation marks '

Subtle difference in look, but the two symbols are different, to find backtick, it is usually located under the ~ symbol in general keyboard beside the number 1.

Also, remember to follow the exact sentence the lesson instructed, follow everything with the spelling, spaces, and punctuation (it’s better if you can just copy from the lesson to avoid errors).


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.