String Interpolation Question

Hi good evening .
I have a problem with code when im going to check the result.
my name or age in numbers are not showing there.
Here is a link

could you plese help me out.

Hello, @web9003930154, and welcome to the forums.

Consider this line from your code:

console.log('My name is ${myName}. I am ${myAgeInDogYears} years old in dog years.');
//          ^                                                                     ^


My name is {myName}. I am {myAgeInDogYears} years old in dog years.

versus this example:

const name = "Bart Simpson";
console.log(`My name is ${name}.`);
//          ^                   ^


My name is Bart Simpson.

For string interpolation you want to use back ticks, not quotes/single quotes. You’re using single quotes, which works for string concatenation, but not string interpolation.

console.log(`like this`);
console.log('not this');
1 Like