Rodrigo
Rodrigo

Reputation: 391

Avoid using Object.values

df is an array of objects

I want to simplify this code, maybe the usage of Object.values could be redundant if I use another thing than map

Object.values(df.map(o => o.prop))

This piece of code returns an array of props.

Is it possible?

Upvotes: 0

Views: 49

Answers (1)

Bergi
Bergi

Reputation: 665286

Unless df is a sparse array, the Object.values is totally redundant indeed.

df.map(o => o.prop)

already returns the same value as

Object.values(df.map(o => o.prop))

Upvotes: 1

Related Questions