A VALUE is a location in computer memory that stores DATA.

There are many kinds of values, including String, Number, Array, Date, ...

(The different kinds of values are called TYPES. Soon you will create your own types but for now, we will use the built-in ones.)


A number is what it sounds like -- any integer or decimal.



A string is an object that's a collection of characters, like a word or a sentence.

"Cherry Pie"


A boolean is a value that is either true or false.

(It's named after George Boole, a 19th-century mathematician who invented Boolean algebra.)

Messages and Operators

All values respond to messages.

You send messages using operators, like PLUS (+) and TIMES (*) and DOT (.)

(Dot is a special operator; we will learn more about her later.)

Return Values

Every time a value receives a message, it returns a response.

You can think of it as the answer to a question.

2 + 2    // Question: What is 2 + 2?
4        // Answer: 4

// Q: What is the all-caps version of the string "apple"?
// A: the string "APPLE"

The response is often called the return value; you can also say that a statement evaluates to a value, as in "2 plus 2 evaluates to 4".

Return Values (cont.)

Sometimes the return value is the same as the original value.

4 * 1    // return value: 4

Sometimes the return value is a different value.

2 + 3    // return value: 5

Sometimes the return value is a different value and a different type.

"banana".length  // return value: 6

Sometimes the return value is a magic value!

(5).shape      // return value: undefined
5 / 0          // return value: Infinity
"cookie" * 10  // return value: NaN