Created
August 1, 2019 10:43
-
-
Save Neophen/e313b954eb107deeb7b5583d4b3c360e to your computer and use it in GitHub Desktop.
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
let variable; | |
console.log(typeof variable); // undefined | |
variable = "1"; | |
console.log(typeof variable); // string | |
variable = 2; | |
console.log(typeof variable); // number | |
variable = true; | |
console.log(typeof variable); // boolean | |
variable = {}; | |
console.log(typeof variable); // object | |
variable = Symbol(); | |
console.log(typeof variable); // symbol | |
//Some things to be aware of | |
console.log(typeof doesntExist); // is aldo undefined | |
variable = null; | |
console.log(typeof variable); // object, this is a javascript language bug | |
variable = function(){}; | |
console.log(typeof variable); // function, while not a primite type it has it's own return type for the typeof operator | |
variable = [1,2,3]; | |
console.log(typeof variable); // object, why for function and not array? Because of reasons :) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment