数组`lineControl.every()`函数返回未定义

时间:2020-08-21 11:40:18

标签: javascript return undefined

const GAME_STATE = {
    'board': [
        [1, 1, 1],
        [null, null, null],
        [null, null, null]
    ],
    'overControl': false
}

...

function lineControl() {
    const { board } = GAME_STATE;
    board[0].every(e => e === 1);
}

我正在尝试制作井字游戏,但我的lineControl()函数返回null

1 个答案:

答案 0 :(得分:0)

像这样更改您的lineControl函数

function lineControl() {
    const { board } = GAME_STATE;
    return board[0].every(e => e === 1);
}