javascript embed variable in string code example
Example 1: how to put variable in string javascript
var myInt = 1
console.log(`my variable is ${myInt}`);
// my variable is 1
Example 2: adding a variable to a string without using + in javascript
let a = 5;
let b = 10;
console.log(`The sum of a and b is ${a+b} and the multiplication is ${a*b}`);
// The sum of a and b is 15 and the multiplication is 50