1

Just curious if anyone knows if there is a difference between:

const dict = Object.setPrototypeOf({}, null);

and

const dict = Object.create(null);

see:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/setPrototypeOf

  • 1
    I have to ask: why? Once is a call that can be invoked at any point during runtime, the other only during assignment, so I'm curious why you're focussing on the one time they might be doing the same thing. Especially when the first is a function that no well written code will ever use. – Mike 'Pomax' Kamermans Nov 20 '18 at 00:22
  • 1
    Yeah, the second one makes a lot more sense to see in code than the first one. – jfriend00 Nov 20 '18 at 00:37

0 Answers0