Skip to main content
Ganesh Joshi
Back to Cheatsheets

JavaScript object methods

Updated 2026-02-15

Object.keys, Object.values, spread, destructuring, and optional chaining. Copy and merge objects.

Keys, values, entries

Object.keys(obj), Object.values(obj), Object.entries(obj). Object.fromEntries(entries).

Spread and copy

{ ...obj } shallow copy. { ...obj, key: newVal } override. Deep clone: structuredClone(obj) or JSON parse/stringify (no functions/dates).

Destructuring and optional chaining

const { a, b } = obj; const { a: x } = obj; default: const { a = 1 } = obj. obj?.prop, obj?.[key], fn?.(). ?? nullish coalescing.

JavaScript object methods | Cheatsheet | Ganesh Joshi