Converting Object to an Array

array,tipjs

Converting Object to an Array

const zoo = {
  lion: '🦁',
  panda: '🐼',
};

Object.keys(zoo);
// ['lion', 'panda']

Object.values(zoo);
// ['🦁', '🐼']

Object.entries(zoo);
// [ ['lion', '🦁'], ['panda', '🐼'] ]

Có thể bạn đã miss một số snippets code

Hàm lày ngày trong tuần javascript

Hàm lày ngày trong tuần javascript

flatMap()

Use flatMap() creates a new array with sub-array elements flattened by specified depth.

promise in javascript

promise in javascript

Làm phẳng mảng dùng phương pháp đệ quy

Làm phẳng mảng dùng phương pháp đệ quy

Spread Operator for Objects

Using the spread operator during an Object declaration will assign the properties of the referenced Object to the new Object.