Wire arrays into the prototype chain (Array.prototype → Object.prototype), add the Array global with isArray(), and implement callback-based methods (map, forEach, filter, find, findIndex, some, every, reduce, reduceRight, sort) plus simple methods (includes, lastIndexOf, reverse, shift, unshift). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
8 lines
236 B
JavaScript
8 lines
236 B
JavaScript
console.log([1, 2, 3].some(x => x > 2));
|
|
console.log([1, 2, 3].some(x => x > 10));
|
|
console.log([].some(x => true));
|
|
|
|
console.log([1, 2, 3].every(x => x > 0));
|
|
console.log([1, 2, 3].every(x => x > 1));
|
|
console.log([].every(x => false));
|