Object Static Methods

The Object constructor carries the reflection toolkit. keys(), values() and entries() list own enumerable string keys only. Object.hasOwn() safely replaces obj.hasOwnProperty(), even on null-prototype objects, and Object.is() differs from === only for NaN and -0. Object.groupBy() (Baseline since March 2024) returns a null-prototype object.

Object static methods by purpose
Purpose Methods
Create and copy create, assign, fromEntries
List and test keys keys, values, entries, getOwnPropertyNames, hasOwn
Prototypes, descriptors, locking getPrototypeOf, defineProperty, freeze, seal
Compare and group is, groupBy
Transforming, testing and grouping with Object methodsJavaScriptLive
const prices = { pen: 1.5, book: 12, [Symbol("sku")]: 7 };
const half = Object.fromEntries(Object.keys(prices).map((k) => [k, prices[k] / 2]));
const dict = Object.create(null);           // no prototype, no inherited keys
console.log(Object.values(prices), half, Object.hasOwn(dict, "toString"));
console.log(Object.is(NaN, NaN), Object.groupBy(["a", 1, "b"], (x) => typeof x));