- Number: Any number, including numbers with decimals:
- String: Any grouping of characters on your keyboard (letters, numbers, spaces, symbols, etc.) surrounded by single quotes:
' ... 'or double quotes
" ... ". Though we prefer single quotes. Some people like to think of string as a fancy word for text.
- Boolean: This data type only has two possible values— either
false(without quotes). It’s helpful to think of booleans as on and off switches or as the answers to a “yes” or “no” question.
- Null: This data type represents the intentional absence of a value, and is represented by the keyword
- Undefined: This data type is denoted by the keyword
undefined(without quotes). It also represents the absence of a value though it has a different use than
- Symbol: A newer feature to the language, symbols are unique identifiers, useful in more complex coding. No need to worry about these for now.
- Object: Collections of related data.
But before we do that, let’s get comfortable with strings and numbers!
console.log('Location of Codecademy headquarters: 575 Broadway, New York City'); console.log(40);
In the example above, we first printed a string. Our string isn’t just a single word; it includes both capital and lowercase letters, spaces, and punctuation.
Next, we printed the number 40, notice we did not use quotes.
On line 1, log the string
On line 2, log the number
2011 to the console.
On line 3, print
'Woohoo! I love to code! #codecademy' to the console.
On line 4, print the number
20.49 to the console.