blob: 5e9be37d127af647a55448340a6c511f8bc2b700 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
var a = [1, , 2];
Array.prototype[1] = 3;
function f(arr) {
return arr[0] + arr[1] + arr[2];
}
for (var i=0; i<70; i++) {
assertEq(f(a), 6);
}
Object.defineProperty(Array.prototype, "1", {
get: function() {
return 1234;
}
});
assertEq(f(a), 1237);
assertEq(f(a), 1237);
|