Created
October 27, 2016 04:01
-
-
Save wklug/bdb3f047d0bd00157e00e8a9ec353efa to your computer and use it in GitHub Desktop.
JS + ES6 - Built-in types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* JS + ES6 - Buit-in types. | |
* | |
* There are 6 built-in types in JavaScript (undefined, string, number, boolean, null, object). Plus, a new one | |
* introduced with ES6 (symbol). | |
**/ | |
var foo; | |
console.log(typeof foo); // "undefined" | |
var bar = 'P. Nutt'; | |
console.log(typeof bar); // "string" | |
var biz = 10; | |
console.log(typeof biz); // "number" | |
var boo = true; | |
console.log(typeof boo); // "boolean" | |
var bat = null; | |
console.log(typeof bat); // "object", wait! This should be null. Where is the object?! | |
var ppl = { | |
name: 'P. Nutt' | |
}; | |
console.log(typeof ppl); // "object" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment