Build a Roman Numeral Converter Project - Build a Roman Numeral Converter

7-11 is what is missing from mine

Good! Now the crash is gone. Take a look at each console.log steps error. Steps 7-11 are the same.

  1. When the #number element contains the number 9 and the #convert-btn element is clicked, the #output element should contain the text “IX”.

If you input 9, the result is VIII.

  1. When the #number element contains the number 16 and the #convert-btn element is clicked, the #output element should contain the text “XVI”.

If 16, result is XV.

With this, you know that the while loop is running fine. But it’s stopping 1 value short. The post above explained why the infinite loop was happening, try digesting it.

    for (const [roman,number] of numerals) {
      while (number < value) {
        result += roman;
        value -= number;
      }

All that needs to be done is ensuring that this line while (number < value) continues the loop while there is “1” left in the input. Right now, when number:1 < value:1, the code stops working. So the result never += the roman key assigned to number.

value” is the one that decreases in the loop, “number” is part of the for…of loop that is being checked against. (Meaning it goes from M:1000 while loop to I:1 while loop) if done right, it will eventually be number:1 < value:0 and the loop ends.

Do not remove or change the < operator, only add something to it.

If this doesn’t work, there might be an fcc bug.