将 .forEach 切换到循环?

问题描述

我可以将这个 .forEach 切换到 for 循环吗?很好奇我是否可以用 for 循环来做同样的事情

 choices.forEach((choice) => {
        const number = choice.dataset['number'];
        // This will populate the choices into the "choice-option" in the html
        choice.innerText = currentQuestion['choice' + number];
    });
    // This removes the old question and adds a new one//
    // .splice method on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice//
    unusedQuestions.splice(questionIndex,1);
    acceptAnswers = true;
};

谢谢!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)