**Tell us what’s happening:**

Why are the “helpful hints” for the challenge so different to code solutions given?

I’ve spent a while typing out the code below (my fault), but felt there must be a better way.

Looking at even the basic solution, its so elegant yet there is no where that tells you how to write elegant code.

I guess I just want to rant.

But also want to ask, where can I learn about writing good code and coming up with elegant solutions?

**Your code so far**

```
function convertToRoman(num) {
var numArr=[];
var romArr=[];
numArr=num.toString().split("");
var ones=numArr[numArr.length-1];
var romOnes=0;
if (ones==0) {
romOnes="";
} else if (ones>0 & ones<4) {
romOnes="I";
for (i=0; i<ones-1; i++) {
romOnes = romOnes + "I";
}
} else if (ones==4) {
romOnes="IV";
} else if (ones==5) {
romOnes="V";
} else if (ones>5 && ones<9) {
romOnes="V";
for (i=0; i<ones-5; i++) {
romOnes = romOnes + "I";
}
} else if (ones==9) {
romOnes="IX";
}
if (numArr.length>1) {
var tens=numArr[numArr.length-2];
var romTens=0;
if (tens==0) {
romTens="";
} else if (tens>0 & tens<4) {
romTens="X";
for (i=0; i<tens-1; i++) {
romTens = romTens + "X";
}
} else if (tens==4) {
romTens="XL";
} else if (tens==5) {
romTens="L";
} else if (tens>5 && tens<9) {
romTens="L";
for (i=0; i<tens-5; i++) {
romTens = romTens + "X";
}
} else if (tens==9) {
romTens="XC";
}
}
if (numArr.length>2) {
var hundreds=numArr[numArr.length-3];
var romHundreds=0;
if (hundreds==0) {
romHundreds="";
} else if (hundreds>0 & hundreds<4) {
romHundreds="C";
for (i=0; i<hundreds; i++) {
romHundreds = romHundreds + "C";
}
} else if (hundreds==4) {
romHundreds="CD";
} else if (hundreds==5) {
romHundreds="D";
} else if (hundreds>5 && hundreds<9) {
romHundreds="D";
for (i=0; i<hundreds-5; i++) {
romHundreds = romHundreds + "C";
}
} else if (hundreds==9) {
romHundreds="CM";
}
}
return num;
}
convertToRoman(99);
```

**Your browser information:**

Your Browser User Agent is: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36`

.

**Link to the challenge:**