Comment

Comment by weatherlight

that's not equivalent.

      d.map(i => o[i] = i\*2)
Will produce a new array on top of mutated data, o, in the parent scope.

      d.forEach(i => o[i] = i**2)
would be the one-to-one equivlent

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton