DEV Community

loading...

Discussion on: Keeping Your Code Simple

Collapse
themightyt_v3 profile image
theMightiestT

I am wondering why you chose reduce instead of sort for your array method? In the example you provided (comparing 2 strings), sort seems to accomplish what you're after and it's really short... the first index is the longest.