Concatenate String in JavaScript.

Using + Operator

You can use + operator to concatenate strings in JavaScript.

let str1 = "Hello";
let str2 = "World";
console.log(str1 + " " + str2);
// -  "Hello World"

Using Template Literals

Template literals can also be used to concat two or more strings.

let str1 = "Hello";
let str2 = "World";
console.log(`${str1} ${str2}`);
// -   "Hello World"

Using String Concat

String has an in built method called concat to concatenate string.

let str1 = "Hello";
let str2 = "World";
console.log(str1.concat(str2));
// -   "HelloWorld"