0
HELP! Simple function(JavaScript), can’t output variables.
Function message(){ Let name = prompt(‘Enter your name.’); Let vacation = prompt(‘what is your favorite vacation spot?’); document.write(‘ ${name}, you love to travel to ${vacation}’); } Message(); //=======BROWSER======== ${name}, you love to travel to ${vacation} // it’s not outputting my variables. What am I doing wrong?
2 Respuestas
+ 3
you are using single quotes where template string must be enclosed by backticks (`):
document.write(`${name}, you love to travel to ${vacation}`);
0
visph thank you so much for that. that clearied it up for me!!!