February 2018
Intermediate to advanced
298 pages
8h 22m
English
ES8 introduced the Object.values() method so that a programmer can retrieve all the values of an object as an array. This was earlier possible by manually iterating over every property of the object and storing its value in the array.
Here's an example:
const obj = { book: "Learning ES2017 (ES8)", author: "Mehul Mohan", publisher: "Packt", useful: true};console.log(Object.values(obj));
The output will be:
["Learning ES2017 (ES8)", "Mehul Mohan", "Packt", true]
Read now
Unlock full access