We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.

dazweeja • 8 years ago

Instead of slice(), you could use filter(v => v)

Niels • 8 years ago

Yes, however, that would remove all falsy items from the array (null, undefined, 0, '').

dazweeja • 8 years ago

That's definitely an important caveat with filter but I just meant for your example, where you're sorting the users. I thought in that specific case, filter would fit nicely with the functional Javascript angle of the article ;)

OlegM • 9 years ago

Great article man and solid advice on using reduce.