js判斷對象是否存在某個屬性

hasOwnProperty:用來判斷某個對象是否含有指定的屬性的 Boolean 。web var obj = {a:"1",b:"2"} obj.hasOwnProperty('a')//true obj.hasOwnProperty('c')//false
相關文章
相關標籤/搜索