42個の組み合わせ((1,1)などの同じ値の組み合わせは無視する)を表示させたいのですが、なぜか43組みになってしまいます。
解決策をお願い致します。
JavaScript
1function main(shuffleList) { 2 var quotient, remainder; 3 4 for (i = 0; i < shuffleList.length; i++) { 5 var x = shuffleList[i]; 6 quotient = Math.floor(x / 7); 7 remainder = x % 7; 8 if (quotient !== remainder) { 9 console.log(quotient); 10 console.log(remainder); 11 console.log("##############"); 12 } 13 else { continue; } 14 } 15} 16 17function shuffle() { 18 var list = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49]; 19 20 //シャッフル 21 for (var i = list.length - 1; i > 0; i--) { 22 var r = Math.floor(Math.random() * (i + 1)); 23 var tmp = list[i]; 24 list[i] = list[r]; 25 list[r] = tmp; 26 } 27 return list; 28} 29var shuffleList = shuffle(); 30
main(shuffleList); が抜けているのでは?
このままでは動きません。
回答2件
あなたの回答
tips
プレビュー