Why 0 is not returned by the following filter ?
[0, 5, 4].sort().filter(function(i){return i}) // returns : [4, 5]
0 is considered a falsy value.
0
Your filter function is essentially returning false for 0 and filtering it from the array.
false
Check this out for a deeper look.