string templates javascript code example
Example 1: javascript template string
const classes = `header ${ isLargeScreen() ? '' :
`icon-${item.isCollapsed ? 'expander' : 'collapser'}` }`;
Example 2: string literal javascript
`string text`
`string text line 1
string text line 2`
`string text ${expression} string text`
tag`string text ${expression} string text`
Example 3: ${} js
let x = 5;
console.log("hello world " + x + " times");
console.log(`hello world ${x} times`);