What does ${} (dollar sign and curly braces) mean in a string in Javascript? -


i haven't seen here or on mdn. i'm sure i'm missing something. there's got documentation on somewhere?

functionally, looks allows nest variable inside string without doing concatenation using + operator. i'm looking documentation on feature.

example:

var string = 'this string';  console.log('insert string here: ${string}'); 

you're talking template literals.

they allow both multiline strings , string interpolation.

multiline strings:

console.log(`foo bar`); // foo // bar 

string interpolation:

var foo = 'bar'; console.log(`let's meet @ ${foo}`); // let's meet @ bar 

Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -