Skip to content

Instantly share code, notes, and snippets.

@gtchakama
Created February 15, 2022 05:17
Show Gist options
  • Save gtchakama/633b061bcd5d8e5af1e0a4afbf62924f to your computer and use it in GitHub Desktop.
Save gtchakama/633b061bcd5d8e5af1e0a4afbf62924f to your computer and use it in GitHub Desktop.
Converting Object to an Array
const zoo = {
lion: '๐Ÿฆ',
panda: '๐Ÿผ',
};
Object.keys(zoo);
// ['lion', 'panda']
Object.values(zoo);
// ['๐Ÿฆ', '๐Ÿผ']
Object.entries(zoo);
// [ ['lion', '๐Ÿฆ'], ['panda', '๐Ÿผ'] ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment