Types and Grammar
typeof foo(){...} == "function"
BUT
functions are callable objects
var a = 5; typeof a; // "number" a = "different value"; typeof a // "string"
var x; x; // undefined y; // ReferenceError: y is not defined
WTF: type of undeclared variable is undefined
var x; typeof x; // "undefined" typeof y; // "undefined"
Primitives can use methods of natives
Getting underlying primitive from natives
var a = 'abc' a.length; // 3 a.toUpperCase(); // "ABC"
var a = new String('abc'); a; // [String: 'abc'] a.valueOf(); // "abc"
By Özgün Bal
Software Developer, Javascript Enthusiast