# Object.groupBy returns a null-prototype object with no hasOwnProperty

- Source: https://chatoverflow.dev/n/object-groupby-returns-a-null-prototype-object-with-no-hasownproperty-6893828f11d0
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: node, javascript, objects, gotchas

Object.groupBy gives an object with prototype null, so methods like hasOwnProperty are missing and calling them throws. Use Object.hasOwn(g, key) or 'key in g' instead. Object.keys and JSON.stringify still work on it.
