Skip to content

Instantly share code, notes, and snippets.

@wklug
Created October 27, 2016 04:01
Show Gist options
  • Save wklug/bdb3f047d0bd00157e00e8a9ec353efa to your computer and use it in GitHub Desktop.
Save wklug/bdb3f047d0bd00157e00e8a9ec353efa to your computer and use it in GitHub Desktop.
JS + ES6 - Built-in types
/**
* 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