一、点(.)或方框号([ ])
var obj = {
test: ‘123‘
}
obj.test
obj[‘test‘]
二、in 运算符
var obj = {
test: ‘123‘
}
test in obj
三、hasOwnProperty()
var obj = {
test: ‘123‘
}
obj.hasOwnProperty(‘test‘)
原文地址:https://www.cnblogs.com/hyshi/p/11679396.html
时间: 2024-11-05 15:49:45