What is typeof for a function in JavaScript?
'function'. Functions are a distinct type, but under the hood they are callable objects. They can even have their own properties, though this is rarely useful.
Explore This Question
Search for additional explanations using these tools:
More FAQs in Functions as First-Class Citizens in JavaScript
Functions are treated like any other value. They can be assigned to variables, passed as arguments, returned from other functions, stored in data structures, and have a type (typeof is 'function').
Yes. Passing functions as arguments is how callbacks work. setTimeout, map, filter, fetch.then, and event listeners all accept functions as arguments.
Yes. A function that returns another function is called a higher-order function. The returned function often captures the outer variable environment, creating a closure.
Still have questions?
Browse all our FAQs or reach out to our support team
