如何获得超出预期的结果?

var mark = 0;
var rightAns=0;
var wrongAns = 0 ;
var notAttempt=0;

questionId = ['1', '2', '3','4', '5', '6','7', '8', '9']

answer = [ 'B', 'D', 'C','E', 'E', 'E', 'E', 'E', 'E']

for(let i = 0 ; i<questionId.length ; i++){

    if(answer[i]==='E'){
      notAttempt +=1; 
    }

else{

    Questions.findOne({where:{id: questionId[i]}})
     .then(question=>{

         if(answer[i]===question.answer){
          rightAns+=1; 
         }else{ 
          wrongAns+=1;
         }

    }) 
   }

 };
评论