What is the output of the following code: console.log(typeof function(){});?

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".

Reference:

JavaScript MCQ (Multiple-Choice Questions)

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top