Is the order of iteration for javascript array methods (map, forEach, reduce, etc) deterministic?

Viewed 3287

Is the order of iterating through an array using one of the native methods (map, forEach, reduce, filter, etc) deterministic and guaranteed by the standard?

EG, are foo, bar, baz, and qux guaranteed to be [0, 2, 6, 12]?

const a = [1, 2, 3, 4];
const foo = a.map((item, index) => item * index);
const bar = []; a.forEach((item, index) => bar[index] = item * index);
const baz = []; a.reduce((total, item, index) => baz[index] = item * index, 0);
const qux = []; a.filter((item, index) => qux[index] = item * index);
// etc

(These are (very) contrived examples)

1 Answers
Related