Why in JavaScript both “Object instanceof Function” and “Function instanceof Object” return true?

前端 未结 7 1188
梦如初夏
梦如初夏 2020-11-27 03:33

Why in JavaScript do both Object instanceof Function and Function instanceof Object return true?

I tried it in Safari WebInspe

7条回答
  •  攒了一身酷
    2020-11-27 04:15

    Object is a built-in constructor function for objects. It is therefore a function (an instance of Function). Functions are objects in JavaScript, it is therefore an object too (an instance of Object).

提交回复
热议问题