set21

Build a running list with immutable spread

21 / 26
read the snippet · pick its Big-O
// Looks idiomatic, runs slowly. Avoid in hot paths.
function buildIds(events) {
let ids = [];
for (const e of events) {
ids = [ids, e.id];
}
return ids;
}