1function convertToRoman(num)
2{
3 let map = {
4 1000 : "M",
5 900 : "CM",
6 500 : "D",
7 400 : "CD",
8 100 : "C",
9 90: "XC",
10 50: "L",
11 40: "XL",
12 10: "X",
13 9: "IX",
14 5: "V",
15 4: "IV",
16 1: "I"
17 }
18 let roman = "";
19 let romankeys = Object.keys(map).reverse();
20 romankeys.forEach((keys) => {
21 while(keys <= num)
22 {
23 roman += map[keys];
24 num -= keys;
25 }
26
27 });
28 return roman;
29}
30
31//https://www.rapidtables.com/convert/number/how-number-to-roman-numerals.html (The refrence for the Roman Calculator)
32console.log(convertToRoman(20));