What does `Object.entries({a:1, b:2})` return?

JavaScript Developer Easy

JavaScript Developer — Easy

What does `Object.entries({a:1, b:2})` return?

Key points

  • Object.entries() returns an array of arrays.
  • Each sub-array contains a key-value pair from the object.
  • The keys and values are preserved in the output.
  • It's a useful method for iterating over object properties.

Ready to go further?

Related questions