Everything in JavaScript is an object!’. We said that this assertion is false. Many things in JavaScript can behave like an object, but that doesn’t mean it’s the object. We can say we have three types of objects (objects, functions and arrays) in JavaScript.

In ECMAScript Specification, the functions aren’t on the type list. Intuitively, function values have a specific behaviour, that is different from values that are numbers - so isn’t it a type? JavaScript refers to functions as a sub-type of the object type - sometimes refers to them as a callable object.

Conclusion: Functions are sort of type, but a sub-type - not a top level type…

#javascript-development #javascript-tips #programming-tips #javascript #programming

How to start writing less error-prone code in JavaScript
6.20 GEEK