var obj = {text:"xxxx"};
obj.hasOwnProperty('name'); // --> false
obj.hasOwnProperty('text'); // --> true
如果提示:
Do not access Object.prototype method 'hasOwnProperty' from target object no-prototype-builtins
解决:
Object.prototype.hasOwnProperty.call(obj, 'key')