ScanSkill

concat

The concat() method is used to concatenate two strings.

Syntax

string1.concat(string2)

Example

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.