← Back to challenges

Roman Numeral Converter

JavaScriptHardarraysdata_structuresnumbers

Instructions

Create a function that takes an Arabic number and converts it into a Roman number.

Examples

convertToRoman(2) ➞ "II"

convertToRoman(12) ➞ "XII"

convertToRoman(16) ➞ "XVI"

Notes

  • All roman numerals should be returned as uppercase.
  • The largest number that can be represented in this notation is 3,999.
javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.