**Tell us what’s happening:**

Hello,

My first post, asking for help, so please be gentle

The code I’ve written returns the desired result, I’m not figuring out why it does not accept my solution.

Can you please help me understand?

Tks in advance,

LAsan

**Your code so far**

‘’’

var roman = “”;

var m = “M”; //1000

var d = “D”; //500

var c = “C”; //100

var l = “L”; //50

var x = “X”; //10

var v = “V”; //5

var i = “I”; //1

var cm = “CM”; //900

var cd = “CD”; //400

var xc = “XC”; //90

var xl = “XL”; //40

var ix = “IX”; //=9

var iv = “IV”; //=4

function convertToRoman(num) {

// num >1000

var mTimes = Math.floor(num/1000);

num = num - (mTimes*1000);

roman += m.repeat(mTimes);

```
// if (num > 900) {
var cmTimes = Math.floor(num/900);
num = num - (cmTimes*900);
roman += cm.repeat(cmTimes);
// if (num > 500) {
var dTimes = Math.floor(num/500);
num = num - (dTimes*500);
roman += d.repeat(dTimes);
// if (num > 400) {
var cdTimes = Math.floor(num/400);
num = num - (cdTimes*400);
roman += cd.repeat(cdTimes);
// if (num > 100) {
var cTimes = Math.floor(num/100);
num = num - (cTimes*100);
roman += c.repeat(cTimes);
// if (num > 90) {
var xcTimes = Math.floor(num/90);
num = num - (xcTimes*90);
roman += xc.repeat(xcTimes);
// if (num > 50) {
var lTimes = Math.floor(num/50);
num = num - (lTimes*50);
roman += l.repeat(lTimes);
// if (num > 40) {
var xlTimes = Math.floor(num/40);
num = num - (xlTimes*40);
roman += xl.repeat(xlTimes);
// if (num > 10) {
var xTimes = Math.floor(num/10);
num = num - (xTimes*10);
roman += x.repeat(xTimes);
// if (num > 9) {
var ixTimes = Math.floor(num/9);
num = num - (ixTimes*9);
roman += ix.repeat(ixTimes);
// if (num > 5) {
var vTimes = Math.floor(num/5);
num = num - (vTimes*5);
roman += v.repeat(vTimes);
// if (num > 4) {
var ivTimes = Math.floor(num/4);
num = num - (ivTimes*4);
roman += iv.repeat(ivTimes);
// if (num > 1) {
var iTimes = Math.floor(num/1);
num = num - (iTimes*1);
roman += i.repeat(iTimes);
return roman;
```

}

convertToRoman(1004);

```
**Your browser information:**
Your Browser 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://www.freecodecamp.org/challenges/roman-numeral-converter
```