Untitled

 avatar
unknown
plain_text
2 years ago
492 B
6
Indexable
const gameBoardController = (() => {
  const gameBoardArray = ['', '', '', '', '', '', '', '', ''];
  const generateNewBoard = () => {
    for (i of boardSquares) {
      i.innerText = '';
      i.style.cursor = `pointer`;
      i.addEventListener('click', handlePlayerMove);
    }
  };

  const placeMarker = (index, marker) => {
    gameBoardArray[index] = marker;
  };

  const getPositions => gameBoardArray;

  return {
    generateNewBoard,
    placeMarker,
    getPositions
  };
})();
Editor is loading...