© 2026 Hedgehog Software, LLC
let gameBoard = Array(3) .fill() .map(() => Array(3).fill("X")); //Create 2D Array const resetGameBoard = () => gameBoard.forEach((arr, index) => { console.log(arr === gameBoard[index]); // this shows they are the same object? console.log(arr.map((item) => item = "")); arr = arr.map((item) => item = ""); }); resetGameBoard(); console.log(gameBoard);
arr = arr.map((item) => item = "");
gameBoard[index] = arr.map((item) => item = "");