0
Why this code doesn't work?
let b = ['eleven ', 'twelve ', 'thirteen ', 'fourteen ', 'fifteen ', 'sixteen ', 'seventeen ', 'eighteen ', 'nineteen '] function digital( numberTwo) { for (let j = 1; j < b.length; j++) { if (j == numberTwo) { j -= 10; console.log(b[j - 1]); } } } digital(12)
2 Antworten
+ 1
Your condition is never reached
because b.length is less than numberTwo
0
Alpha, thank you, I already correct
for (let j = 1; j <= b.length + 10; j++) {
if (j == numberTwo) {
j -= 10;
console.log(b[j - 1]);
break;
}
}