JavaScript Algorithms and Data Structures Projects: Roman Numeral Converter #2

Tell us what’s happening:
I decided to use the splice method and join method for this algorithm while setting up 3 arrays for the roman numerals. The first array is for the one’s place. The second array is for the 10’s place. The third array is the hundreds to thousands’ place. Does that make sense?

Your code so far


function convertToRoman(num) {

var romanNum1 = {
1: "I",
2: "II",
3: "III",
4: "IV",
5: "V",
6: "VI",
7: "VII",
8: "VIII",
9: "IX"}
var romanNum2 = {
10: "X",
20: "XX",
30: "XXX",
40: "XL",
50: "L",
60: "LX",
70: "LXX",
80: "LXXX",
90: "XC"}
var romanNum3 = {
100: "C",
200: "CC",
300: "CCC",
400: "CD",
500: "D",
600: "DC",
700: "DCC",
800: "DCCC",
900: "CM",
1000: "M",
2000: "MM",
3000: "MMM"
}
for (var i= num; num.length; i++) {
 num
 .splice(num, 3, romanNum)
 .indexOf(romanNum1, romanNum2, romanNum3 )
 .join(romanNum3, romanNum2 , romanNum1);
}
}

convertToRoman(36);

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36.

Challenge: Roman Numeral Converter

Link to the challenge: