...

Combine Strings with Concatenation

One interesting thing you can do with strings is concatenation. This means combining two or more strings together to form a new string. For example:

console.log("Welcome, " + "Neo!");

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

The + operator

The + operator is normally used to add numbers together. But when you use the + operator with strings (text), it doesn't add them like numbers. Instead, it joins them together into one longer string. This is called concatenation.

Try running the code sample to see string concatenation in action!

Loading...

Output (Console)