I have seen Object.create(null) being used in numerous tutorials (e.g.
http://killdream.github.com/blog/2011/10/understanding-javascript-oop/),
but I don't understand what's the point of it. Are there situations where
it would be preferable to not inherit from Object.prototype?
var myObj = Object.create(null); // sets __proto__ to null
var myObj = {}; // sets __proto__ to
Object.prototype
var myObj = new Object(); // sets __proto__ to Object.prototype
--
To view archived discussions from the original JSMentors Mailman list:
http://www.mail-archive.com/[email protected]/
To search via a non-Google archive, visit here:
http://www.mail-archive.com/[email protected]/
To unsubscribe from this group, send email to
[email protected]