Sunday, March 20, 2016

How to create an empty object

Object.create(null) is similar to { }, but without the delegation to Object.prototype, so it's "more empty" than just { }

var emptyObj = Object.create( null );

Reference:

https://github.com/getify/You-Dont-Know-JS/blob/master/this%20&%20object%20prototypes/ch2.md

No comments: