I\'m trying to populate a 2D array in javascript with random numbers. Although each column in the array is random, each row is identical which is not what I want (see image bel
One way of doing this using map
let op = new Array(10) .fill(0) .map(e=>(new Array(5) .fill(0) .map(e=> Math.floor(Math.random() * 5)))) console.log(op)