a place to learn javascript for today's world.

Object Methods

Following is a list of the object methods that I find most useful daily. For a complete list you can go to the Mozzila JavaScript documentation for objects.

Object.assign(target, ...sources ) -- target is a target object and sources are source objects. Mainly used to shallow clone an object. (easiest way to deep clone is by using JSON.parse with JSON.stringify).

example

let obj = { somekey: 100 };
let cloneOfObject = Object.assign({}, obj);

Object.entries(obj) -- returns an array of the object's values mixed with keys.

Object.keys(obj) -- returns an array of the object's keys.