Object.keys/values/entries, assign & freeze in JavaScript
Static Object methods operate on objects wholesale: keys/values/entries return arrays of names, values, or [key, value] pairs (own string keys only — symbols need getOwnPropertySymbols); assign(target, ...sources) merges left-to-right mutating the target; freeze/seal/preventExtensions lock shapes with escalating strictness.
entries() plus for...of (or map/filter) turns objects into pipeline-friendly pairs and back via Object.fromEntries — the round trip powering object transforms. freeze is shallow (nested objects stay mutable) and silent outside strict mode.
Enumerate as arrays
Object.keys/values/entries snapshot own string-keyed content into arrays for methods and loops.
assign merges left to right
Object.assign(target, a, b) copies into target (mutating it!) with later sources winning — spread usually reads better.
entries round-trips
Object.fromEntries(Object.entries(o).map(...)) transforms objects through pair pipelines.
Lock shapes deliberately
preventExtensions (no new keys), seal (+ no delete/reconfigure), freeze (+ no writes) — shallow locks, strict-mode loud.
let scores = { a: 1, b: 2 };console.log(Object.keys(scores).length);let doubled = Object.fromEntries( Object.entries(scores).map(([k, v]) => [k, v * 2]));console.log(doubled.b);Recommended resourcesAffiliate links · may earn us a commission
Recommended for learners
Practice what you learned
Re-implement each visualized algorithm in JavaScript yourself — building beats watching.