Object and Function are quite confusing

前端 未结 7 1788
隐瞒了意图╮
隐瞒了意图╮ 2020-12-10 03:47
Object instanceof Object
true
Object instanceof Function
true
Function instanceof Object
true
Function instanceof Function
true

so if Function is a

7条回答
  •  一整个雨季
    2020-12-10 04:13

    instanceof operator indicates if the first argument is of the given type. That is saying

     A instanceof B
    

    returns true if A is an instance of the type B.

    The == and === operators are comparison operators on the other hand. They compare values for equality.

    For instance, you can say jack instanceof Boy is true but would you say that jack == boy? No.

提交回复
热议问题