Works on codepen but not in challenge?

My code works in code pen, but when I try and put it into the freecodecamp challenge, it says nothing passes.
It’s returning a string and the letters are correct, so why is it coming up as a complete fail?

  **Your code so far**

function convertToRoman(num) {
let roman = [];
let newNum = num;

while (newNum > 0) {
  if (newNum >= 3000) {
    roman.push("MMM");
    newNum = newNum - 3000;  
  }
  if (newNum >= 2000){
roman.push("MM");
newNum = newNum - 2000;
  }
if (newNum >= 1000){
roman.push("M");
newNum = newNum - 1000;
}
if (newNum >= 900){
roman.push("CM");
newNum = newNum - 900;
}
if (newNum >= 800){
roman.push("DCCC");
newNum = newNum - 800;
}   
if (newNum >= 700){
roman.push("DCC");
newNum = newNum - 700;
} 
if (newNum >= 600){
roman.push("DC");
newNum = newNum - 600;
}
if (newNum >= 500){
roman.push("D");
newNum = newNum - 500;
}    
if (newNum >= 400){
roman.push("CD");
newNum = newNum - 400;
} 
if (newNum >= 300){
roman.push("CCC");
newNum = newNum - 300;
}
if (newNum >= 200){
roman.push("CC");
newNum = newNum - 200;
}    
if (newNum >= 100){
roman.push("C");
newNum = newNum - 100;
} 
if (newNum >= 90){
roman.push("LC");
newNum = newNum - 90;
}   
if (newNum >= 80){
roman.push("LXXX");
newNum = newNum - 80;
}      
if (newNum >= 70){
roman.push("LXX");
newNum = newNum - 70;
}  
if (newNum >= 60){
roman.push("LX");
newNum = newNum - 60;
}  
if (newNum >= 50){
roman.push("L");
newNum = newNum - 50;
} 
if (newNum >= 40){
roman.push("XL");
newNum = newNum - 40;
}
if (newNum >= 30){
roman.push("XXX");
newNum = newNum - 30;
} 
if (newNum >= 20){
roman.push("XX");
newNum = newNum - 20;
}  
if (newNum >= 11){
roman.push("XI");
newNum = newNum - 11;
}  
if (newNum >= 10){
roman.push("X");
newNum = newNum -10;
}
if (newNum >= 9){
roman.push("IX");
newNum = newNum - 9;
}
if (newNum >= 8){
roman.push("VIII");
newNum = newNum - 8;
}
if (newNum >= 7){
roman.push("VII");
newNum = newNum - 7;
}
if (newNum >= 6){
roman.push("VI");
newNum = newNum - 6;
}
if (newNum >= 5){
roman.push("V");
newNum = newNum - 5;
}
if (newNum >= 4){
roman.push("IV");
newNum = newNum - 4;
}
if (newNum >= 3){
roman.push("III");
newNum = newNum - 3;
}
if (newNum >= 2){
roman.push("II");
newNum = newNum - 2;
}
if (newNum >= 1){
roman.push("I");
newNum = newNum - 1;
}
  
} // while loop closer 
console.log(roman.join(''));
}

convertToRoman(1001);
  **Your browser information:**

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.3 Safari/605.1.15

Challenge: Roman Numeral Converter

Link to the challenge:

Where are you returning your string?

1 Like

oh frack. thank you I forgot I have to return it different with codepen and the code camp. thank you for your kindness!