i was wondering how javascript Array sort method works, when a custom sorting function is specified like the one below :
arr = [1, 5, 122, 12];
arr.sort(function (a,b){return a-b;});
if it only accepts two arguments a,b (1,5) in "arr", i know that javascript allow more arguments than those specified in the function. but how sort function is acting, does it compares 1,5 then 122,12, store result in a place then redo the comparison.