How we concatenate strings in javascript ? by using plus ( + ) symbol. If you want to place variable value in string, then you have to concatenate strings using plus symbols. ES6 has given a better way to do this by using template literals.
Using ES5
var name = "srinivas" var str = "hi "+name+" this is sample string" console.log(str);
Using ES6
Here name was added to string using ${...}
var name = "srinivas" var str = `hi ${name} this is sample string`; console.log(str);
0 comments:
Post a Comment