Skip to content

Instantly share code, notes, and snippets.

@rdeprey
Created April 2, 2019 00:05
Show Gist options
  • Select an option

  • Save rdeprey/c6050b8dd8a21383d4a318cd46be8e89 to your computer and use it in GitHub Desktop.

Select an option

Save rdeprey/c6050b8dd8a21383d4a318cd46be8e89 to your computer and use it in GitHub Desktop.
Get a two-dimensional array of an object's key/value pairs using the Object.entries() method
const taco = {
tortillaType: 'corn',
meat: 'chicken',
toppings: 'lettuce, cheese, tomatoes',
};
const tacoArr = Object.entries(taco);
console.log(tacoArr); // Expected output: [['tortillaType', 'corn'], ['meat', 'chicken'], ['toppings', 'lettuce, cheese, tomatoes']]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment