var my_var1=" Hello Welcome"
var my_var2=" to plus2net.com "
var my_var3= " JavaScript Section "
var my_var=my_var1.concat(my_var2, my_var3)
document.write(my_var);
The output of above code will be
Hello Welcome to plus2net.com JavaScript Section
We can add two or more strings by using concat string function in JavaScript.
var new_var="";
new_var= new_var.concat("First one", " Second One", " Third one ");
document.write(new_var)
By using + operator
We can add strings by using + operation also like this
var my_var1=" Hello Welcome"
var my_var2=" to plus2net.com "
var my_var3= " JavaScript Section "
var my_var=my_var1 + my_var2 + my_var3
document.write(my_var);
Same result we can achieve by using single variable this way
var my_var=""
my_var +=" Hello Welcome"
my_var +=" to plus2net.com "
my_var += " JavaScript Section "
document.write(my_var);