JavaScript Introducing ES2015 Objects and New Collection Types Map

` vs '

What is the difference between ` and ' mark?

1 Answer

james south
james south
Front End Web Development Techdegree Graduate 33,249 Points

the first is the backtick and is used to encase the new template literal syntax. the latter is the single quote, still available to encase strings.

let a = 'i am a string made with single quotes';
console.log(`i am a template literal made with backticks. here is the previous string: ${a}.`);

i am a template literal made with backticks. here is the previous string: i am a string made with single quotes.