This site is a preview of the curriculum for our Summer 2018 bootcamp in Burlington, Vermont. As we continue our preparation, courses and lessons will appear and disappear; we will rename, rearrange, clarify, and obfuscate as needed... Please consider this a work in progress and keep checking in.
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.
10 -12 3.14
A string is an object that's a collection of characters, like a word or a sentence.
"apple" "banana" "Cherry Pie"
A boolean is a value that is either
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.)
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"? "apple".toUpperCase() // A: the string "APPLE" "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