为什么在此显示参考错误“未定义valuesIdx”?

时间:2018-07-20 20:17:29

标签: javascript for-loop referenceerror

// // BlackJack``
// By Hannah Matthewson
//
let suits = ['Hearts', 'Clubs', 'Diamonds', 'Spades'];
let values = ['Ace', 'King', 'Queen', 'Jack', 'Ten', 'Nine', 'Eight', 'Seven', 'Six', 'Five', 'Four', 'Three', 'Two'];

let deck = [];

for (let suitsIdx = 0; suitsIdx < suits.length; suitsIdx++); {
  for (let valuesIdx = 0; valuesIdx < values.length; valuesIdx++); {
    deck.push(values[valuesIdx] + ' of ' + suits[suitsIdx]);
  }
}

let i = 0;

for (let i = 0; i < deck.length; i++); {
  console.log(deck[i]);
}

let playerCards = [deck[0], deck[2]];
console.log("Welcome to BlackJack!");

console.log("You are dealt...");
console.log(" " + playerCards[0]);
console.log(" " + playerCards[2]);

0 个答案:

没有答案