js concatenate strings and variables code example
Example 1: string concatenation in js
var str1 = "Hello ";
var str2 = "world!";
var res = str1.concat(str2);
console.log(res);
Example 2: js concat string
const str1 = 'Hello';
const str2 = 'World';
console.log(str1.concat(' ', str2));
// expected output: "Hello World"
console.log(str2.concat(', ', str1));
// expected output: "World, Hello"
Example 3: string javascript concatenation
var dest = new String("");
var src = new String("aze");
...
dest += src + src + src + src + src;