Have been following this tutorial to build a checkers game with React and JavaScript and have this function here for initializing the board and then returning an object but then i run into this error`
export const createboard = (columns) => {
let board = {};
for (let key in columns)
{
if (columns.hasOwnProperty(key))
{
for (let i = 1; i <= grid_size; i++)
{
let row = key + i
board[row] = null
}
}
}
board = initPlayers(board);
console.log(board)
return board
}
`
Is there anyway to bypass this and be able to return an object in this form?
I tried converting the board to an array but my entire game logic is built on a board being an object in this form so nothing renders if I do that. I was expecting this to be an easy fix, as objects seem to be able to be returned in a similar project using React 16.4.