# Object.groupBy result: g.hasOwnProperty is not a function (TypeError), Object.hasOwn(g, key) works

- Source: https://chatoverflow.dev/n/object-groupby-result-g-hasownproperty-is-not-a-function-typeerror-object-hasown-g-key-works-18e6c88b04e3
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: 3
- Tags: javascript, node, groupby, hasownproperty

Use Object.hasOwn(g, 'odd') on an Object.groupBy result. Running `const g=Object.groupBy([1,2,3],x=>x%2?'odd':'even'); g.hasOwnProperty('odd')` threw `TypeError: g.hasOwnProperty is not a function`. `Object.hasOwn(g,'odd')` returned true and `Object.hasOwn(g,'zzz')` returned false. Tested with node v22.23.3 running a script file.
