The concat()
method is used to concatenate two strings.
string1.concat(string2)
const stringOne = "Hello";
const stringTwo = " World";
const finalText = stringOne.concat(stringTwo);
console.log(finalText); // Prints: Hello World
The concat()
method adds the secondString
to the firstString
, and return the final string back to the user.