Created
April 8, 2021 08:49
-
-
Save antonydenyer/51bf0d06943a874da99baf955a8db942 to your computer and use it in GitHub Desktop.
Revisions
-
antonydenyer created this gist
Apr 8, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ const toRoman = (numeral) => new Array(numeral + 1) .join('I') .replaceAll('IIIII', 'V') .replaceAll('VV', 'X') .replaceAll('XXXXX', 'L') .replaceAll('LL', 'C') .replaceAll('CCCCC', 'D') .replaceAll('DD', 'M') .replaceAll('IIII', 'IV') .replaceAll('VIV', 'IX') .replaceAll('XXXX', 'XL') .replaceAll('LXL', 'XC') .replaceAll('CCCC', 'CD') .replaceAll('DCD', 'CM'); toRoman(2020); toRoman(1999);