JavaScript · Middle · Question 47 of 75

What does Object.fromEntries(Object.entries({ a: 1, b: 2 }).map(([k, v]) => [k, v * 10])) return?

Explanation

Object.entries turns an object into an array of pairs that array methods work with, and Object.fromEntries collects pairs back into an object. This is the standard way to "map over an object". For grouping there's Object.groupBy.

Further reading

Problem with a question

JavaScript · Middle · question 47

Test yourself

Take the JavaScript · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz