Not sure what I'm missing with String Interpolation?


#1

var favoriteAnimal = 'dog';
console.log('My favorite Animal: ' + dog);

I have redone this several times. I'm sure the solution is obvious. This is the wording of the problem:
1.
Create a variable named favoriteAnimal and set it equal to your favorite animal.

2.
Then, use console.log to print: 'My favorite animal: Koala', but replace 'Koala' with your favoriteAnimal variable.
Hint
Use the + operator to interpolate the favoriteAnimal variable.

Help!


#2

it wants you to call the variable. this means that you created the variable favoriteAnimal and made it equal Dog and now instead of just typing dog you can use the name of the variable favoriteAnimal instead. so when you typed console.log('My favorite Animal: ' + dog);
it wants you to use the name of the variable that you made in the line before.


#3

O_M_G, right in front of my face! Thanks so, so much!


#4

haha its no problem. even little mistakes can mess your whole program up, but don't get discouraged because eventually it will all just click into place. good luck on the course! :smile:


#5

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