Sikau

JavaScript · Day 4 · about 25 min

Text in code

Strings, quotes, and why "5" is not 5.

Words are data too

Names, messages, addresses, passwords — most of what apps handle is text. Today you'll learn how JavaScript stores and joins text.

What is a string?

In programming, a piece of text is called a string — think of letters strung together like beads on a thread.

You make a string by wrapping text in quote marks. Double "…" or single '…' both work — just use the same kind at the start and end.

console.log("Pokhara");
console.log('Lakeside');
console.log("Ama's momo");

The rest of this lesson

  • Joining stringsexplain
  • "5" is not 5explain
  • Quotes inside stringsexplain
  • Predict the outputpredict
  • Left to rightpredict
  • Your turnwrite code
  • Fix the bugwrite code
  • Challengechallenge
  • Badge quizquiz
  • What you learnedrecap

Continue this lesson free — run real code in your browser

Continue with Google

See all 68 lessons of JavaScript