typeof 100 "number" typeof udf //未声明的变量udf "undefined" typeof [] "object" typeof function(){} "function" typeof {x:1} "object" typeof null "object" Object.prototype.toString.apply([]) "[object Array]" Object.prototype.toString.apply({a:1}) "[object Object]" Object.prototype.toString.apply(function(){}) "[object Function]" Object.prototype.toString.apply(null) "[object Null]"
hasOwnProperty(‘x‘)
function foo(){}; foo.prototype.x=1; var obj=new foo(); obj.hasOwnProperty(‘x‘) //false obj.__proto__.hasOwnProperty(‘x‘)//true
时间: 2024-10-28 19:44:32