📜  javascript 填充二维数组 - Javascript 代码示例

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

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

console.log(fillSquareMatrix(3));