Object.assign() copies enumerable own properties from source objects into a target object and returns it. Covers merging, cloning, and defaults.
Reference
Object Methods
Static methods on the Object constructor.
- Object.assign()
- Object.create()
Object.create() creates a new object with a specified prototype and optional property descriptors for direct control over prototypal inheritance.
- Object.defineProperty()
Object.defineProperty() lets you define or modify a property directly on an object with precise control over writability, enumerability, and configurability.
- Object.entries()
Object.entries() returns an array of [key, value] pairs from an object's own enumerable properties, useful for iteration, filtering, and transformation.
- Object.freeze()
Object.freeze() makes an object completely immutable, preventing new properties, deletions, and value changes. Returns the same object, not a copy.
- Object.fromEntries()
Object.fromEntries() converts an iterable of key-value pairs into a plain object, useful for transforming Maps, Arrays, and URLSearchParams back to objects.
- Object.getPrototypeOf()
Object.getPrototypeOf() returns an object's prototype — the value in its internal [[Prototype]] slot. Use it to inspect inheritance and verify object types.
- Object.hasOwn()
Object.hasOwn() checks whether an object has a direct property without traversing the prototype chain — a safer alternative to hasOwnProperty().
- Object.is()
Object.is() compares two values with special handling for NaN and signed zeros, treating NaN as equal to itself and distinguishing +0 from -0.
- Object.keys()
Object.keys() returns an array of an object's own enumerable string-keyed property names. Learn how to iterate, count, and transform object keys in JavaScript.
- Object.seal()
Object.seal() restricts an object by preventing new properties from being added or removed, while still allowing existing property values to be modified.
- Object.setPrototypeOf()
Object.setPrototypeOf() mutates an object's [[Prototype]] to another object or null — a powerful but slow operation best avoided in performance-sensitive code.