Lesson 4 of 10

Numbers, words, yes/no

Every value has a kind. Numbers, words, or yes and no.

Three kinds:
  • numbers
  • words
  • yes or no

Scene 1 of 5

Every value has a kind. This 7 is a number.

A jar named age . Inside: 7
Scene 1 of 5

Tip

Quotes turn anything into a word.

Library

All about kinds

What is a kind?

Every value has a kind. The kind tells the computer what it can do with it.

Numbers

Numbers are for counting and adding. They never wear quotes.

Words

Words wear quotes. In JavaScript, a word is called a string. Even "7" with quotes is a word!

Yes or no

Some questions have two answers. true means yes. false means no. This kind is called a boolean.

Asking for the kind

typeof asks a value, "What kind are you?" The value tells you.

Numbers
42
Words
"Hi!"
Yes or no
true, false

Words to know

  • number = for counting
  • string = a word in quotes
  • boolean = yes or no
  • typeof = what kind is it?