...

Concatenation with Multiple Strings

In the previous lesson, we saw a simple string concatenation involving two strings. This lesson provides a more complex example involving variables and multiple strings joined together using the + operator.

let greeting = "Welcome";
let target = "Neo";
let message = greeting + ", " + target + "!";
console.log(message);

In the example above, we combined four separate strings "Welcome", ", ", "Neo" and "!" to create a single string "Welcome, Neo!".

Try running the code sample to see how this concatenation executes step by step.

Loading...

Output (Console)