异步意外标识符

时间:2018-06-15 16:50:42

标签: javascript node.js

async start_game() {
    this.query.getWords(NUMBER_OF_WORDS_IN_ONE_CYCLE, NUMBER_OF_WORDS_IN_ONE_ROUND)
    await sleep(3000)

    // Game loop
    while (true) {
        this.next_play_state()
        await sleep(DURATION_OF_ROUNDS);
        this.wait_for_scores_state()
        await sleep(DURATION_WAIT_FOR_SCORES)
        this.show_scores_state()
        await sleep(DURATION_SHOW_SCORES)
    }
}

上述函数表明start_game是一个意外的标识符(https://imgur.com/5W1kPrC

上面的代码在一台带有linux的计算机上运行,​​我目前正试图在cloud9中运行它,有什么想法吗?

1 个答案:

答案 0 :(得分:0)

使用const start_game = async() => { }async function start_game() { }