Polyfilled Array.sort with callback fails when a breakpoint is added.
Opened this issue · 1 comments
jmkulwik commented
Code:
function swap(arr, first_Index, second_Index){
var temp = arr[first_Index];
arr[first_Index] = arr[second_Index];
arr[second_Index] = temp;
}
var bubble_sort = function(comp){
var len = this.length,
i, j, stop;
for (i=0; i < len; i++){
for (j=0, stop=len-i; j < stop; j++){
if (comp(this[j], this[j+1]) > 0){
swap(this, j, j+1);
}
}
}
return this;
}
Array.prototype["sort"] = bubble_sort;
console.log([3, 0, 2, 5, -1, 4, 1].sort(
function(a,b) {
return b-a
}
));
Error message:
Uncaught Error: step(onStep) requires the program to be paused