# Post your Roman Numeral Converter solutions here! (Fall 2022)

**URL:** <https://group.classcentral.com/t/post-your-roman-numeral-converter-solutions-here-fall-2022/35779>\
**Category:** JavaScript Bootcamp\
**Created:** [September 21, 2022, 8:30am UTC](https://group.classcentral.com/t/post-your-roman-numeral-converter-solutions-here-fall-2022/35779 "2022-09-21T08:30:22Z")\
**Posts on this page:** 1\
**Showing post:** 33

<div class="post-metadata">

**Author:** ![stevenr2945563](https://avatars.discourse-cdn.com/v4/letter/s/bc79bd/32.png) [@stevenr2945563](https://group.classcentral.com/u/stevenr2945563)\
**Post date:** [September 28, 2022, 4:55pm UTC](https://group.classcentral.com/t/post-your-roman-numeral-converter-solutions-here-fall-2022/35779/33 "2022-09-28T16:55:54Z")

</div>

After reviewing some of the other solutions, I’ve gone ahead and refactored:

```auto
function convertToRoman(num) {
 const conversions = [
  [1000, "M"],
  [900, "CM"],
  [500, "D"],
  [400, "CD"],
  [100, "C"],
  [90, "XC"],
  [50, "L"],
  [40, "XL"],
  [10, "X"],
  [9, "IX"],
  [5, "V"],
  [4, "IV"],
  [1, "I"]
]

 let countDown = num;
 let romanStr = "";
 for (let i = 0; i < conversions.length; i++) {
   while (countDown >= conversions[i][0]) {
     romanStr += conversions[i][1];
     countDown -= conversions[i][0];
   }
 }
 
 return romanStr;
}

console.log(convertToRoman(36));

```

---

_[View the full topic](https://group.classcentral.com/t/post-your-roman-numeral-converter-solutions-here-fall-2022/35779)._
