📜  二维数组 javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:37.392000             🧑  作者: Mango

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

console.log(fillSquareMatrix(3));