var a1 = [[0,1],[0,1],[1,1]],
a2 = [[0,0,0,0,0,0],[0,0,0,0,0,0],[0,0,0,0,0,0]],
res = a2.map((s,i) => s.map((n,j) => a1[i][j] !== void 0 ? a1[i][j] : n));
The code is supposed to overlay a1 onto a2, but how exactly does it do this?
What are the variables s, i, j, and n?
Code taken from answer to this question:
How to impose a 2D array on top of another in JavaScript - Quora[
^]
What I have tried:
I have tried putting the code in to
jsfiddle where it finds some errors but it seems to work.