continueステートメントの構造化された同等のものがJavaScriptにあるのだろうか?私はcontinueステートメントを取り除こうとしていますが、どうしたらよいか分かりません。誰かが私を正しい方向に向けることができますか?ありがとう!JavaScriptのcontinueステートメントに相当する
function Hand() {
this.cards = new Array();
this.addOneCard = function(card) {
this.cards.push(card);
}
this.evaluateHand = function(){
// Needs to handle two aces better
var total1 = new Number;
var total2 = new Number;
for(var i in this.cards) {
if (this.cards[i].value == "A") {
total1 += 1;
total2 += 11;
continue;
}
if (isNaN(this.cards[i].value * 1)) {
total1 += 10;
total2 += 10;
continue;
}
total1 += Number(this.cards[i].value);
total2 += Number(this.cards[i].value);
}
return [total1, total2];
};
}
なぜ変更が必要ですか? 'continue'は言語の一部であり、あなたの必要性に合っています。 –