Kyle mentioned that null could mutate or reference the global object in a function that makes a 'this' reference in either your own code or in a third party library.
The empty object literal {} still has __proto__ since it inherited from 'Object'.
If you use a third party library or you have code that checks for properties on 'this' then you could have a difficult bug.
Object.create(null) truly is more empty than {}. It has no properties which makes it the safer 'this' option.
No comments:
Post a Comment