Tell us what’s happening:
i am trying to move from one conditional statement to another but it wont proceed from the first stage to the next conditional statement
Your code so far
function convertToRoman(num) {
let rom =""
for (var i=num; i>=0; ){
if (i >= 10 && i <40){
rom += "X";
i-=10
console.log(i)
if(i === 9){
rom += "IX";
i-=9;
console.log(rom)
if (i<9 && i>6){
rom += "I"
i-=1;
console.log(i)
if(i===5){
rom += "V";
i-=5;
}
if(i === 4){
rom += "IV";
i-=4;
if (i <= 3 ){
rom += "I";
i-=1
}
}
}
}
}
}
return rom
}
convertToRoman(36);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/roman-numeral-converter