MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/reactjs/comments/r7cklo/coding_interview_with_dan_abramov/hn0gtec
r/reactjs • u/camouflage365 • Dec 02 '21
140 comments sorted by
View all comments
Show parent comments
1
Nice! Editing it a bit, I like this slightly more:
const invertTree = (node) => node && { left: invertTree(node.right), right: invertTree(node.left), value: node.value, };
0 u/[deleted] Dec 05 '21 This one doesn't modify it in place, but looks nice as an immutable alternative.
0
This one doesn't modify it in place, but looks nice as an immutable alternative.
1
u/franciscopresencia Dec 03 '21
Nice! Editing it a bit, I like this slightly more: