In his Eloquent Javascript, Haverbeke claims that (page 16):
"In a JavaScript system, most of this data is neatly separated into things called values. Every value has a type, which determines the kind of role it can play. There are six basic types of values: numbers, strings, Booleans, objects, functions, and undefined values."
But Crockford in Javascript: The Good Parts says:
"The simple types of JavaScript are numbers, strings, booleans (true and false), null, and undefined. All other values are objects. Numbers, strings, and booleans are object-like in that they have methods, but they are immutable. Objects in JavaScript are mutable keyed collections. In JavaScript, arrays are objects, functions are objects, regular expressions are objects, and, of course, objects are objects."
Now, at least under V8 I get this:
> typeof function(){};
'function'
> typeof {};
'object'
I don't understand if object is a type and function is an object or if function and object are both types. I guess I'm missing the distinction between primitive types and other kind of types (composite types?).