Skip to content
Your progress

Checking your sign-in…

Who's learning?

Each profile keeps its own read lessons, badges, streak, and practice scores on this device.

Lesson 3 of 11

Four kinds of value, and why the quotes matter

Show on a big screen

7 min

Text size

12 is a number. "12" looks the same but is not. Quote marks make it text.

Loading lab…

Four kinds, one value each: 12, "12", true, null.
Step 1 of 3
  1. Four kinds, one value each: 12, "12", true, null.
  2. 12 and "12" look alike on the page.
  3. They are two different kinds.

The rule

The kind of a value is what the machine holds. It is not how the writing looks. Run it and ask: number, text, true or false, or nothing?

The four kinds of value, and one of each
The kindWritten down
number12
text"12"
true or falsetrue
nothingnull

4.5 is a number too. Whole numbers and numbers with a decimal point are one kind here. The sign / divides, so 12 / 8 gives 1.5.

Quotes change the answer. 12 + 8 adds two numbers and gives 20. "12" + 8 joins the two as text and gives "128".

0 is a number. "" is text with no characters. false is a true or false value, not nothing. In this editor, only null means no value at all.

print writes something out. It gives back nothing.

Try the lab to finish this lesson.