The data type of javascript

i have know that JavaScript data types are either:Primitive (number", “string”, “boolean”, “undefined”,“null"), or
Non-primitive (objects). but why the return values of using typeof can be “function”? i feel this collide with the above.

Probably because it’s important enough to tell functions from other types of objects, and because it is possible to detect it. (A function object implements [[Call]] as described in the ECMA-262 standard.)

Functions are objects in JavaScript, so it fits in quite well with your first statement.

but when you typeof a function, it will show function not object.why?

Because JavaScript allows functions to be passed around as values and arguments, it is useful to be able to distinguish them from other objects.