Roman Numeral Converter is not executing

Tell us what’s happening:
code is not running.output console shows running test . what should I do

Your code so far


function convertToRoman(num) {
 var roman="";
 var romanN=["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"];
 var p=[1000,900,500,400,100,90,50,40,10,9,5,4,1];
 for(i=0;i<p.length;i++)
 {
     if(num>=p[i])
     {
         roman=roman+romanN[i];
         num=num-p[i];
     }
 }
 return romman;

}

convertToRoman(36);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36 Edge/17.17134.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/roman-numeral-converter/

Still a little work to do after you fix this I think, but you’ve misspelled roman (return romman)

1 Like