DEV Community

Manav Misra
Manav Misra

Posted on

Answer: TIC TAC TOE javascript

Using an array similar to what's shown in the above ๐Ÿ‘†๐Ÿพanswer, we can just use a few different array methods:

const WINNING_INDICES = [
  [0, 1, 2]
  [0, 3, 6],
  [0, 4, 8],
  [1, 4, 7],
  [2, 5, 8],
  [2, 4, 6],
  [3, 4, 5],
  [6, 7, 8],
];

function
โ€ฆ

Discussion (0)