convert numbers into roman numerals code example
Example 1: roman numerals converter table embed
if (/^(0|[1-9]\d*)$/.test(arabic)) {
if (arabic == 0) {
outputField.innerHTML = "Nulla";
} else if (arabic != 0) {
for (let i = 0; i < arabicArray.length; i++) {
while (arabicArray[i] <= arabic) {
roman += romanArray[i];
arabic -= arabicArray[i];
}
}
outputField.innerHTML = roman;
}
} else {
outputField.innerHTML =
"Please enter non negative integers only. No decimal points.";
}
Example 2: roman numerals converter table embed
function convertToRoman() {
let arabic = document.getElementById('arabicNumeral').value;
let roman = '';
}