convert into roman js
function integer_to_roman(num) {
if (typeof num !== 'number')
return false;
var digits = String(+num).split(""),
key = ["","C","CC","CCC","CD","D","DC","DCC","DCCC","CM",
"","X","XX","XXX","XL","L","LX","LXX","LXXX","XC",
"","I","II","III","IV","V","VI","VII","VIII","IX"],
roman_num = "",
i = 3;
while (i--)
roman_num = (key[+digits.pop() + (i * 10)] || "") + roman_num;
return Array(+digits.join("") + 1).join("M") + roman_num;
}
console.log(integer_to_roman(27));
Also in JavaScript:
- react how to create range
- cm to inches
- dynamic component angular parameters
- hoverintent.min.js wordpress error
- intro to graphs with js
- how to make an async function
- Find parent and child from array javascript
- d3.select specific div
- javascript switch case regex
- discord js v12 get user tag with id
- eliminare spazi inizio e fine stringa javascript
- load_jsonl love jsonl
- jquery array compare values
- insertion sort javascript
- how to do radio button validation in jquery
- span change jquery
- lazy react
- CocoaPods could not find compatible versions for pod "ReactCommon/jscallinvoker"
- convert 24 hours to 12 hours javascript
- how to use the match function in javascript for regex
- javascript object read only
- how to add script before </body> in magento 2
- Error [ERR_METHOD_NOT_IMPLEMENTED]: The _write() method is not implemented
- javascript check if element has class