17
I'm trying to sort an array that sometimes has Infinity or NaN. When I use a standard JavaScript array.sort() it seems to sort until it reaches a NaN and then I get random results after that.
var array =[.02,.2,-.2,Nan,Infinity,20];
Is there a way to still sort this so that the end result is from negative to positive and still have NaN or Infinity at the end.
-.2,.02,.2,20,NaN,Infinity