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"

Using ES6

Here name was added to string using ${...}
var name = "srinivas"
var str = `hi ${name} this is sample string`;
Click here to see DEMO

1 comment:

  1. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Front end developer learn from Javascript Training in Chennai . or Javascript Training in Chennai. Nowadays JavaScript has tons of job opportunities on various vertical industry. ES6 Training in Chennai




Popular Posts