What is the error?

Tell us what’s happening:

Your code so far


function convertToRoman(num) 
{
let n=[1,4,5,9,10,40,50,90,100,400,500,900,1000];
let r=["I","IV","V","IX","X","XL","L","XC","C","CD","D","CM","M"];
let i=12;//size of n array
let ans="";
while(num>0)
{
  let a=Math.floor(num/n[i]);
  num=num%n[i];
  while(a>0)
  {
    ans.concat(r[i]);
    a--;
  }
  i--;
}
return ans;

}
convertToRoman(36);

Your browser information:

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

Challenge: Roman Numeral Converter

Link to the challenge:

Strings are immutable and no string methods act in place, but return new instance of the string. Fix this line and you’re good to go!