4

In ES5 lots of Object utilities are defined on the constructor, not the prototype (e.g. defineProperty and keys). What are the reasons behind this design choice? To me, myObject.keys() seems like a much better API than Object.keys(myObject)

wheresrhys
  • 20,222
  • 16
  • 83
  • 154
  • To know the actual reasons, you would have had to have been involved in the discussion about this new feature when it was being designed. I doubt you're going to find that actual information here. – jfriend00 Apr 17 '14 at 09:01
  • 1
    http://stackoverflow.com/questions/11922619/javascript-why-object-keyssomeobject-rather-than-someobject-keys and http://stackoverflow.com/questions/19941499/why-is-object-keys-not-object-prototype-keys – Oleg Apr 17 '14 at 09:04

0 Answers0