Why does codepen thrown an error when I try to run this javascript?
It doesn’t throw there error unless I get into the last else statement.
https://codepen.io/bnjwin/pen/YzbQOzo
else {
let result ="";
for (const [symbol, number] of numerals) {
while (input >= number) {
result += symbol;
input -= number;
}
}
output.innerText = result;
}
I built this code on freecodecamp.org and it works there.
I was expecting it to work on codepen.
New contributor
billwin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.