Stuck on Roman Numerals challenge

Tell us what’s happening:
Hi all,

I’m struggling with this one, I have gone through the roman numerals guide and understand how they work but putting that into logic is proving difficult, so far I have divided the numbers into thousands, hundreds, tens and ones. Can anyone give me a bit of direction to get the ball rolling?

Thanks.

Your code so far


function convertToRoman(num) {

let numbers = [1,4,5,9,10,40,50,90,100,400,500,900,1000];

var romanArr = ["I", "IV", "V", "IX", "X", "XL", "L", "XC", "C", "CD", "D", "CM", "M"];

let dividedNumberArray = num.toString().split("").map(function(e, i, a) {
return e * Math.pow(10, a.length - i -1)})
}

convertToRoman(16);

Your browser information:

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

Challenge: Roman Numeral Converter

Link to the challenge:

I recommend doing some roman numeral translations by hand, just to get used to the logic of how they work. Try converting a bunch of both large and small numbers to roman numerals and then check that you did it correctly. The logic for telling the computer how to convert roman numerals will be very similar to the mental steps you’ll go through to do it yourself.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.