Skip to content

Instantly share code, notes, and snippets.

const convertRoanNumeral = (num) => num
.replace(/CM/g, 'CDD')
.replace(/M/g, 'DD')
.replace(/CD/g, 'CCCC')
.replace(/D/g, 'CCCCC')
.replace(/XC/g, 'XLL')
.replace(/C/g, 'LL')
.replace(/XL/g, 'XXXX')
.replace(/L/g, 'XXXXX')
.replace(/IX/g, 'IVV')