/ Published in: JavaScript

`Object.create(null)` is a more memory-efficient way to make objects, but it's not supported in all versions of JavaScript, so you can do the "old-fashioned" `{}` if that function isn't available.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
Evan.emptyObject = function() { if (Object.create) return Object.create(null); return {}; };
Comments
