Files
rust_browser/tests/external/js262/fixtures/array-forEach.js
Zachary D. Rowitsch 5bdbc87dfb Add Array.prototype, Array global, and 20 array methods
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>
2026-02-23 23:36:02 -05:00

11 lines
271 B
JavaScript

var result = [];
[1, 2, 3].forEach(function(x) { result.push(x * 2); });
console.log(result.join(','));
var indices = [];
['a', 'b', 'c'].forEach(function(v, i) { indices.push(i); });
console.log(indices.join(','));
var r = [1].forEach(function(x) {});
console.log(r);