Variable bindings are possible in ES6 using ${}
.
let name = 'Foo';
var myMsg = `Hello ${name}`;
alert(myMsg); //alert Hello Foo
Note: I have not used single quotes here.
In vanilla JS, to create multiline we have to use \n
. But in ES6, writing in next line will be taken as new line.
let myMsg = `In ES6 multi line
is so easy to create.`
alert(myMsg);
//alert In ES6 multi line
// is so easy to create.