Maybe use the spread operator instead:
const newOutput = Object.entries(data) .map((item, index) => [...item, colors[index] || '#fff']) .sort((a, b) => b[1] - a[1]);
I think it makes more clear that you are not changing the item itself.
Hey Alex,
Great addition! 100% makes sense for readability! Refactor on the refactor 👀
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.
Maybe use the spread operator instead:
I think it makes more clear that you are not changing the item itself.
Hey Alex,
Great addition! 100% makes sense for readability!
Refactor on the refactor 👀