i have gone through this article about Array.prototype.sort().Sort() function can behave differently according to the availability of compareFunction.For strings it does sorting using UNICODE value.But Here in this particular example an array contains two different elements having same first three letters.My question is how compareFunction decides which to go first in a situation like this??
var numbers = ['Hammer',"Hamburger"];
numbers.sort(function(a, b) {
return a - b;
});
console.log(numbers); //['Hammer','Hamburger']