loading...

Create a nxn array

318097 profile image Mehul Lakhanpal Originally published at codedrops.tech ・1 min read
const size = 3;

const arr = new Array(size)
  .fill()
  .map(
    (_) =>
      new Array(size).
        fill(null)
  );

console.log(arr);

Thanks for reading 💙

Follow @codedrops.tech for daily posts.

InstagramTwitterFacebook

Micro-Learning ● Web Development ● Javascript ● MERN stack ● Javascript

codedrops.tech

Discussion

pic
Editor guide