I am trying to sort array of objects based on an integer property. When using lodash's method
_.sortBy() the order is as expected but when I use the built in method it isn't right.
Check the snippet here: jsbin link. It's not the most readable example. I am not able to figure what is wrong with the sort method that I have written. The objects which have delay value 0 should maintain their original order in the array but that's not happening with the native sort method. Let me know in comments if I should edit my example for more clarity.