The null object which is *actually* an object

https://en.dopl3r.com/memes/dank/when-you-feel-empty-inside-but-you-cant-express-it-cause-you-dont-know-any-words/513541
  1. Object.create vs. Object.assign
  2. what it means to have an empty object
  3. what this demonstrates about prototypal inheritance
  4. Is there a use case for Object.create(null) or is this just something interesting in JS, but we don’t have to know about Object.create in depth because we would never do this in practice, and a template literal object definition whose prototype is Object would always be a lot more useful in practice? I saw one article talking about how if using an object as a map, having it be emptied of the default Object properties could prevent problems (which might occur if a key in the map had the same name as a default Object property)
  5. Personally I feel like I can see some benefit to creating simple objects that don’t inherit any properties from Object, but MDN spent a lot of time covering bugs that can arise from using Object.create(null)
  6. How does prototypal inheritance connect to React? Is this why that dude at Roman says Class components don’t fly and it’s better to use functional components + hooks instead of Redux etc?
  7. Let’s look at some prototype-related methods under the hood:
  8. Object.prototype
  9. Object.__proto__
  10. constructor
  11. factory functions

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Theo Carney

Theo Carney

Software Engineer and Chinese Language Nerd