DEV Community

Discussion on: Javascript Array Condensing

Collapse
 
mellen profile image
Matt Ellen

I can sort that out, easy!

arr.sort((a, b) => a === 0 ? -1 : (b === 0) ? 1 : 0)