mirror of https://github.com/svaarala/duktape.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
949 B
37 lines
949 B
12 years ago
|
/*---
|
||
|
{
|
||
|
"custom": true
|
||
|
}
|
||
|
---*/
|
||
|
|
||
|
/*===
|
||
|
0
|
||
|
1
|
||
|
100
|
||
|
3
|
||
|
[1,2,null,4,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"foo"]
|
||
|
===*/
|
||
|
|
||
|
function sparseArrayLengthTest() {
|
||
|
var arr, k;
|
||
|
|
||
|
// sparse array test
|
||
|
arr = [1, 2];
|
||
|
arr[100] = 'foo'; // becomes sparse
|
||
|
arr[3] = 4; // will enumerate "incorrectly"
|
||
|
|
||
|
// FIXME: this is custom behavior actually
|
||
|
for (k in arr) {
|
||
|
print(k);
|
||
|
}
|
||
|
|
||
|
print(JSON.stringify(arr));
|
||
|
}
|
||
|
|
||
|
try {
|
||
|
sparseArrayLengthTest();
|
||
|
} catch (e) {
|
||
|
print(e.name);
|
||
|
}
|
||
|
|