Do not access Object.prototype method ‘hasOwnProperty’ from target object no-pro 初级前端 2020-07-13 943 阅读1分钟 发现是新版本的ESLint使用了禁止直接调用 Object.prototypes 的内置属性开关,说白了就是ESLint 配置文件中的 "extends": "eslint:recommended" 属性启用了此规则。 foo.hasOwnProperty("bar") // error 应该替换为 Object.prototype.hasOwnProperty.call(foo, "bar")。