JavaScript Getting Started With ES2015 Using Template Literals Review Template Literals

Brian M
Brian M
2,018 Points


for one of the Quiz questions, I answered

const name = "Dave"; let message = "Hello ${name}. How are you?" as a way of putting template literals into the variable.

Is there something I'm misssing? because the answer keeps saying its incorrect.


2 Answers

Katrina H
Katrina H
4,141 Points

Hi Brian,

Template literals use the back-ticks instead of double/single quotes. The expression/variable should be wrapped in curly braces ${expression} instead of parentheses.

Reference: MDN Template Literals