Javascript's sort is not c++'s