Common methods of js objects

One, js judges whether the object contains a certain attribute

var obj = {
    
    name:'张三',age:18};
obj.hasOwnProperty('name'); // --> true
obj.hasOwnProperty('id'); // --> false

Guess you like

Origin blog.csdn.net/weixin_42349568/article/details/114368145