Why wont my code not log out roman number of 16 .someone please help

Tell us what’s happening:
Describe your issue in detail here.

   **Your code so far**

function convertToRoman(num) {

let romanNumeral = "";
while (num > 0) {
 if (num < 4) {
   romanNumeral += "I";
   num --
 }else if (num == 4) {
   romanNumeral = "IV";
   num -= 4;
 }else if (num >= 5 && num < 9) {
   romanNumeral = "V";
   num -= 5;
 }else if (num == 9) {
   romanNumeral = "IX"
   num -= 9
 }else if (num >= 10) {
   romanNumeral = "X"
   num -= 10
 }else{
   num --;}
 
}
return romanNumeral;
}

console.log(convertToRoman(16));
   **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36 OPR/76.0.4017.227

Challenge: Roman Numeral Converter

Link to the challenge:

check your statements, do you want to overwrite the romanNumeral string at each iteration, or add to it?

I want to add it through every iteration

Thank you i’ve seen my mistake.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.