JavaScript remplit le tableau en 2 dimensions

const fillSquareMatrix = (size) => {
  return Array(size)
    .fill()
    .map((u,y) => Array(size)
         .fill()
         .map((u,x) => y * size + x + 1));
};

console.log(fillSquareMatrix(3));
Friendly Finch