String is an immutable type, meaning the value cannot be changed. Therefore, each time you change the value of a string, a new string is created. Concatenating a string can be achieved using the '+' operator or the concat()
method. String concatenation is one of the most used operations with strings, but overusing it will overflow the memory as each concatenation allocates new memory.
var str1 = "Hello";
var str2 = " ";
var str3 = "World!";
console.log(str1 + str2 + str3);
console.log(str1.concat(str2).concat(str3));