A lot of it comes down to personal preference I suppose, but the consensus seems to be that nesting like this on one line is hard to read.
I agree that the solution is better, but i would split it up more, into multiple variables with good names, to avoid the nesting and make it more apparent what each step does.
View all comments
Show parent comment
13
u/Lonewolf953 Apr 13 '22 edited Apr 13 '22
funnily enough it was the opposite for me, in the old code I'm still trying to figure out why certain if statements are there to begin with
meanwhile the new code only took me a few seconds to understand, I guess it comes down to how familiar one is with modern JS code
EDIT: all I did was say I understood the new code faster than the old code and I got downvoted, don't give any opinions on reddit, what a surprise..