What is the output of the following code: console.log(typeof function(){});?
a)
"object"
b)
"function"
c)
"undefined"
d)
"object function"
Answer:
b)
"function"
Explanation:
In JavaScript, the typeof
operator returns "function"
when applied to a function. Functions in JavaScript are a special type of object, but typeof
identifies them as "function"
.