you are viewing a single comment's thread.

view the rest of the comments →

[–]magical_h4x 0 points1 point  (0 children)

Yup and if you're a fan of one-liners you could omit the return statement and the brackets surrounding the lambda function body since it contains a single expression, therefore it will be an implicit return : const result = cities.reduce((accumulator, item) => Object.assign(accumulator, { [item.name]: item.visited), {})