Hi,
I’m just wanting to get clarity around interpolation.
Early in the exercise, we learn to use the comma to link the words in quotes to the variable:
var strength=‘50,000 pounds’;
console.log(‘How much stuff can a variable hold?’, strength);
This returned:
How much stuff can a variable hold? 50,000 pounds
Then, we went on to learn about using the + operator to interpolate a variable into a string:
var favoriteAnimal=‘dog’;
console.log('My favorite animal: ’ + favoriteAnimal);
This returned:
My favorite animal: dog
My impression is that in the above exercises, using the + operator and separating with a comma function the same way. But that’s not true, right? Please explain…
Many thanks!