I'm a bit confused about the function data type. So is 'function' in Javascript language really a data type?
But on the ECMAScript site I couldn't find such a thing: ECMAScript® 2020 Language Specification
I'm a bit confused about the function data type. So is 'function' in Javascript language really a data type?
But on the ECMAScript site I couldn't find such a thing: ECMAScript® 2020 Language Specification
It is a type, in a way:
function
member of the Object type that may be invoked as a subroutine
In addition to its properties, a function contains executable code and state that determine how it behaves when invoked. A function's code may or may not be written in ECMAScript.
Functions inherit from objects; you can set arbitrary keys and values on functions (though you usually shouldn't, since it's weird). But functions are a special kind of object which can be invoked and whose typeof evaluates to function.
The page you're looking at doesn't look very precisely written. You might be better served by looking at a different site for an introduction, such as MDN.
typeof function(){} // "function"If that's not what you mean then I'm not entirely sure what you're asking here.typeof