Files
scriptc/tests/corpus/native-array-borrowed-find-last.js
Chris Tate f8906d0b75 Expand static native object and array semantics (#569)
* Support primitive and function property descriptors

* Dispatch literal bracket calls to native class methods

* Handle numeric class method keys in bracket calls

* Call function values returned by class accessors

* Expand native object and array semantics

* Keep new corpus fixtures aligned with compiler gates

* Lower Object.isFrozen arguments once
2026-09-29 08:30:54 -05:00

14 lines
579 B
JavaScript

const record = { 0: 2, 1: 4, 2: 6, length: 3 };
console.log(Array.prototype.findLast.call(record, value => value < 6));
console.log(Array.prototype.findLastIndex.call(record, value => value < 6));
console.log(Array.prototype.findLast.call(record, value => value > 9));
console.log(Array.prototype.findLastIndex.call(record, value => value > 9));
const sparse = { 0: 1, 2: 3, length: 3 };
const seen = [];
console.log(Array.prototype.findLastIndex.call(sparse, (value, index) => {
seen.push(`${index}:${value}`);
return value === undefined;
}));
console.log(seen.join(','));