real life sorting for javascript