JS - 比较两个数组中的两个值似乎不起作用

时间:2018-05-22 15:40:38

标签: javascript arrays

任何人都可以帮我解决这个问题:

    
var questions =[
  ['how many states?', 1],
  ['how many continents?', 2],
  ['how many legs?', 3]
]

var answers = [];
var rightAnswers = [];
var wrongAnswers = [];


for(i = 0; i<questions.length; i+=1){  
  answers.push(prompt(questions[i][0]).toLowerCase());
  
  if(questions[i][1] === answers[i]){
     // rightAnswers.push(questions[i][0]) 
     console.log("success!");
  }else{
     console.log("bummer");
  }
  
}

比较两个阵列的两个插槽似乎不起作用:( 谢谢!

0 个答案:

没有答案