blob: 8e6d0cd0b98617f7977aba8bc3a85bc107b3ac9f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
function comparator(x, y) {
saveStack();
return {valueOf: function() {
saveStack();
return x - y;
}};
}
for (let i = 0; i < 20; i++) {
let arr = [3, 1, 2];
arr.sort(comparator);
assertEq(arr.toString(), "1,2,3");
}
|