Why does it not print

Whenever I use ${} to call reference to a variable it does not print as below.

let userName = ‘Jane’;

userName ? console.log(‘Hello, ${userName}!’)

: cosole.log(‘Hello!’);

let userQuestion = ‘Will I adopt a pupper soon?’

console.log(’${userName}’ has asked - ${userQuetion});

Why could this be?

Check your spelling.

There seems to be a typo:
there’s a line that has
: cosole.log('Hello!');
which should be
: console.log('Hello!');

Also, to use the ${} for variables in strings (string literals), you need the ` instead of '
You also seem to have one of those marks in the wrong place in the last line of code, and userQuestion is spelled incorrectly there.

let userName = 'Jane'; userName ? console.log(`Hello, ${userName}!`) : console.log('Hello!'); let userQuestion = `Will I adopt a pupper soon?`; console.log(`${userName} has asked - ${userQuestion}`);
1 Like

Thank you so much, that was super helpful.