Skip to content

Instantly share code, notes, and snippets.

@rashid327
Created March 21, 2022 09:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rashid327/bc53cf2767a39d5b395cb030bfa24bf6 to your computer and use it in GitHub Desktop.
Save rashid327/bc53cf2767a39d5b395cb030bfa24bf6 to your computer and use it in GitHub Desktop.
Object to Array
const person = [{
firstName: 'John',
lastName: 'Doe'
},
{
firstName: 'John',
lastName: 'Doe'
}];
var propertyValues = [];//Object.values(person[0]);
for (let i = 0; i < person.length; i++) {
propertyValues.push(Object.values(person[i]));
}
console.log(propertyValues);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment