Template literals

Insert string variable or js code into a string

by greatCar

JavaScript

//https://stackoverflow.com/questions/35835362/what-does-dollar-sign-and-curly-braces-mean-in-a-string-in-javascript
//https://stackoverflow.com/questions/41829275/what-is-variable-in-javascript
//https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals
let x = "Gary"
//alert('aaa ${x}');
let y = `Welcome here ${x}!`
//alert ("myname: ${x}")
alert(y);

y = `Welcome here ${x + ' R. Siegel'}!`
//alert ("myname: ${x}")
alert(y);
alert(`Welcome ${name}!`);