String Interpolation II: Why didn't this work?


#1

https://www.codecademy.com/courses/learn-javascript-introduction/lessons/variables/exercises/string-interpolation-ii?action=lesson_resume&course_redirect=introduction-to-javascript

Error message:
Did you interpolate your name and favorite city using ES6 string interpolation?

The code:
var myName = “Bob”;
var myCity = “Bobland”;

console.log(“My name is ${myName}. My favorite city is ${myCity}.”);


If I change the log to this, it works: “My name is Bob. My favorite city is Bobland.”


#2

Hi @digitalmaster53691,

Your console.log must be using ES6 string interpolation.

Use the backticks (`) to wrap the entire string instead of quotation marks " "

Hope it helps. :slight_smile:


#3

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