Files
scriptc/tests/corpus/js-array-iterators.js
Chris Tate a07998f667 Expand static three.js workflows and host integration (#621)
* Expand static three.js workflows and host integration

* Preserve JavaScript class state in static three.js workflows

* Preserve inferred JavaScript behavior across static workflows

* Preserve inferred callables and native compatibility boundaries

* Retain annotated JavaScript factory exports and bootstrap-safe call spreads

* Preserve Buffer and child callback identities in static packages

* Clarify JavaScript symbol spread support
2026-10-02 19:56:34 -05:00

25 lines
895 B
JavaScript

function observe(values) {
console.log([...values.keys()].join(","));
console.log(JSON.stringify([...values.entries()]));
console.log([...values.values()].join(","));
const iterator = values.entries();
console.log(iterator.next().value.join(":"));
values.push(9);
console.log(JSON.stringify([...iterator]));
console.log(iterator.next().done);
values.push(10);
console.log(iterator.next().done);
}
const sparse = new Array(3);
sparse[0] = 1;
sparse[2] = 3;
observe(sparse);
const inherited = new Array(2);
const prototype = Object.create(Array.prototype);
Object.defineProperty(prototype, "0", { get() { console.log("get"); return 4; } });
Object.setPrototypeOf(inherited, prototype);
console.log([...inherited.keys()].join(","));
console.log(JSON.stringify([...inherited.entries()]));
const detached = sparse.entries;
console.log(JSON.stringify([...detached.call(sparse)]));