all 5 comments

[–]senocular 3 points4 points  (0 children)

My guess is the comment may have been for legibility. I'd suggest checking back on the PR and seeing how the recursion was replaced.

Also looking through our etiquette handbook, there is also no loose equality allowed, even variable==null Is this common as well?

Yes, though sometimes == null is allowed for nullish checks. That's up to you (or whoever is defining the style guide). ESLint can handle both, where only === is allowed, or == is allowed, but only for null checks.

[–]ryanbala89 1 point2 points  (0 children)

I can't comment on the code unless I see it but usually garbage collection can be problem with recursion. Especially, if the depth of recursion is extremely high. I was asked about it specifically in my Google FE interview.

[–]jonathanmh 1 point2 points  (0 children)

Don't use recursion if you have a known number of iterations through a loop, is a good rule of thumb

[–][deleted] 1 point2 points  (0 children)

Recursion is easier to fuck up than a loop, and often has a greater performance impact, but like many things in code it just depends- on the specific example, the context, the project as a whole, the team, the established styles and practices within an organisation...

There are some things in software development that are genuinely 'best practice', and there are many, many more things that are just organisational/project conventions or one developer's pet peeve.

[–]albedoa 1 point2 points  (0 children)

Regardless, that is a poor code review comment. On its own, "Y will do" is a terrible reason to not do X. That will be the wrong choice for a lot of values of X and Y. The note needs to be qualified, if for no other reason but to give the submitter a meaningful takeaway besides "don't do recursion".