Reputation: 55739
I can identify the following types in JavaScript:
number, string, boolean, object, null and undefined
But, is function
a discrete type, or is it an instance of object
?
Upvotes: 0
Views: 470
Reputation: 166
Functions in javascript are inherited from Object. You can try the following :
var my_func = function(){};
console.log(my_func instanceof Object); // prints true
console.log(my_func instanceof Function); // also prints true
The same is true for Array.
Upvotes: 1