I use Object.keys frequently, but I always forget about Object.entries!
Object.keys
Object.entries
In my opinion, Object.keys is much simpler than Object.entries
I'm not sure that's always the case (although like you said, it's just opinion). If the goal is to iterate over the values, then
Object.entries(arr).map(x => x)
feels more concise than
Object.keys(arr).map(x => arr[x])
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I use
Object.keys
frequently, but I always forget aboutObject.entries
!In my opinion, Object.keys is much simpler than Object.entries
I'm not sure that's always the case (although like you said, it's just opinion). If the goal is to iterate over the values, then
feels more concise than