Object.entries()

Object.entries() can be used to convert an object into a key/value pair in the form of an array. That means your object will be converted into a 2D array (at the simplest level), with each element being another array containing a key and value. Take a look at this:

const obj = {
book: "Learning ES2017 (ES8)",
author: "Mehul Mohan",
publisher: "Packt",
useful: true
};
console.log(Object.entries(obj));

The output will be:

[["book","Learning ES2017 (ES8)"],["author","Mehul Mohan"],["publisher","Packt"],["useful",true]]
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.116.74.135