JS---학습소결

2050 단어
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

좋은 웹페이지 즐겨찾기