原型污染与解决方法

先放个链接,有空翻译。

https://codeburst.io/what-is-prototype-pollution-49482fc4b638

Object.create(null) 可以创建没有 __proto__constructor 属性的对象。

let a = Object.create(null);
a.constructor => undefined
a.__proto__ => undefined

let b = {};
b.constructor => "[Function: Object]"
b.__proto__ => {}

转载请注明来源,欢迎对文章中的引用来源进行考证,欢迎指出任何有错误或不够清晰的表达。可以在下面评论区评论。
我的空间