3 ms·
The part I’m confused on is the documentation saying the returned object from Object.groupBy doesn’t extend from Object.prototype. Is it still an object? T
by zeroimpl 3y ago
The part I’m confused on is the documentation saying the returned object from Object.groupBy doesn’t extend from Object.prototype. Is it still an object?
The return value of groupBy is an object that does not inherit from %Object.prototype%.
- edflsafoiewq 3y agoIt's called a null-prototype object: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object#null-prototype_objects https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe... They're "usually used as a cheap substitute for maps": the lack of prototype prevents the object from being polluted by keys that morally shouldn't be there, like toString, etc.
- aragonite 3y agoIt's a value that belongs as a member of the Object data type (Object(it)===it), but it's not (in addition) an instance of the Object constructor (!(it instanceof Object)). I guess the former, wider sense of 'an object' is more often intended.