Benefit of concatenation


#1


whats the benefit of concatenation if`

console.log("hey you);
cosole.log(""hey"+" "+"you");

provide same output

hey you`


#2

Yup! Concatenation in the above example is useless. But what if you want to do something like this

var day = 15;
var year = 2016;
console.log(day + " September " + year);

See the result: https://jsbin.com/hiyezavexe/edit?js,console

With the help of concatenation, we can combine variables and string.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.