JS 判断object是否包含某个键

1.


myObj.hasOwnProperty('myKey');


2.


if ('key' in myObj)

 

posted @ 2017-04-26 14:15  狂奔的小狮子  阅读(10333)  评论(0编辑  收藏  举报