**Tell us what’s happening:**

some test results are not working such as 2,3,12 etc

**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(var i=0;i<p.length;i++)
{
if(num>=p[i])
{
roman=roman + romanN[i];
num=num-p[i];
}
}
return roman;
}
convertToRoman(2);
```

**Your browser information:**

User Agent is: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 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/