JS-024
Visual JavaScript guide to String Concatenation: Learn how to join text strings using the + operator
Beginner3 min~3 min read#string#concatenation#operators

String Concatenation

Joining strings together

Goal

Learn how to join text strings using the + operator.

Explanation

  • String concatenation means combining several strings into one.
  • The + operator is used for this.
  • JavaScript simply attaches the text one piece after another.
  • If you need a space between words, you must add it yourself.
  • Joining strings is often used to build messages, titles, and text content.

Analogy

Imagine two train cars. Coupling them together gives you one longer train. JavaScript joins several strings the same way.

Code

let text = "Hello" + " " + "World";

console.log(text);

Result: Hello World

Common mistake

Beginners often forget to add a space between words and get HelloWorld instead of Hello World.

Remember

  • + can join strings.
  • Spaces must be added manually.
  • The result is one new string.

Quick Quiz

What does "Hello" + " " + "World" output?

Resources