summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/basic/for-in-replace-sparse.js
blob: 2a89ec6679e7d1e08318e9cf1f687ae283d8f6a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
// Array with sparse element (because non-writable).
var arr = [];
Object.defineProperty(arr, 0, {writable: false, configurable: true, enumerable: true, value: 0});

for (var p in arr) {
  // Replace sparse element with dense element.
  assertEq(p, "0");
  delete arr[0];
  arr[0] = 0;
  arr[1] = 1;
  arr.reverse();
}