0
点赞
收藏
分享

微信扫一扫

js判断对象上是否含有某个属性

史值拥 2023-05-19 阅读 69


let obj = {
	 name:"张三",
	 age:"32",
	 sex:"男"
}

console.log(obj.hasOwnProperty('age'))   // true
console.log(obj.hasOwnProperty('hobby')) // false


举报

相关推荐

0 条评论