The datatypes listed in MSDN for javascript are Number, String, Boolean, Object, Array, Null, Undefined. However, when you do typeof function, its type is function.
Why is this the case, and what's the definition of datatype?
Functions are just Objects in JavaScript. But the difference lies in an internal property called [[Call]] that differentiates them from normal Objects. When typeof is used against an Object, and if it finds the [[Call]] property, then it returns the String "function".
This behavior can be found in the ECMA Specification for typeof.
typeof { Call: function(){ } } should return function?[[Call]] is an internal property
typeofis special and doesn't actually return the type of the value (according to the spec). It's just a lookup table: ecma-international.org/ecma-262/5.1/#sec-11.4.3Functionis as much a data type asArrayis.