"You don't Know JS: Types & Grammar" Kyle Simpson
best sudoku app iPhone (promo)
“An ECMAScript language type corresponds to values that are directly manipulated by an ECMAScript programmer using the ECMAScript language. The ECMAScript language types are Undefined, Null, Boolean, String, Number, and Object.”
“JavaScript defines seven built-in types: • null • undefined • boolean • number • string • object • symbol-added in ES6! (All of these types except object are called “primitives.”)”
“The typeof operator inspects the type of the given value, and always returns one of seven string values surprisingly, there’s not an exact 1-to-1 match with the seven built-in types we just listed:”
“typeof null === "object" It would have been nice (and correct!) if it returned “null”, but this original bug in JS has persisted for nearly two decades,”
“In JavaScript, variables don’t have types —values have types. Variables can hold any value, at any time… A variable can, in one assignment statement, hold a string, and in the next hold a number, and so on.”
“Variables that have no value currently actually have the undefined value. Calling typeof against such variables will return “undefined””
“Using delete on an array value will remove that slot from the array, but even if you remove the final element, it does not update the length property, so be careful!”
“While the slot appears to have the undefined value in it, it will not behave the same as if the slot is explicitly set (a[1] = undefined).”
“JavaScript strings are immutable, while arrays are quite mutable.”
“JavaScript has just one numeric type: number. This type includes both “integer” values and fractional decimal numbers.”
“Like most modern languages, including practically all scripting languages, the implementation of JavaScript’s numbers is based on the “IEEE 754” standard, often called “floating-point.” JavaScript specifically uses the “double precision” format (aka “64-bit binary”) of the standard.”
More notes at the link "You don't Know JS: Types & Grammar" Kyle Simpson