Theme

Object Methods

Array methods allows us to operate on Array. The following Object methods transform JavaScript object to array so we can operate them.

Object.assign

var ori = {
  a: 1,
  b: 'c',
};

var target = {
  b: 'd',
  e: 5,
};

Object.assign(target, ori);

console.log(target);

Object.keys

var ori = {
  a: 1,
  b: 'c',
};

console.log(Object.keys(ori));

Object.values

var ori = {
  a: 1,
  b: 'c',
};

console.log(Object.values(ori));

Object.entries

var ori = {
  a: 1,
  b: 'c',
};

console.log(Object.entries(ori));