码迷,mamicode.com
首页 > 其他好文 > 详细

判断一个对象中是否有指定属性

时间:2019-05-21 19:27:14      阅读:118      评论:0      收藏:0      [点我收藏+]

标签:.com   图片   pre   log   zhang   highlight   属性   对象   https   

1 hasOwnProperty

var a  = {b:1}
a.hasOwnProperty(‘b‘)
true
a.hasOwnProperty(‘c‘)
false

  2 in

技术图片

 

原链接: https://www.cnblogs.com/guozongzhang/p/10823806.html

 

 

判断一个对象中是否有指定属性

标签:.com   图片   pre   log   zhang   highlight   属性   对象   https   

原文地址:https://www.cnblogs.com/star-x/p/10901604.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!