あれ?こんなクソコードっぽいので行けたぞ?
あれ?こんなクソコードっぽいので行けたぞ?
var a = [ [1000, "M"], [900, "CM"], [500, "D"], [400, "CD"], [100, "C"], [90, "XC"], [50, "L"], [40, "XL"], [10, "X"], [9, "IX"], [5, "V"], [4, "IV"], [1, "I"] ]; var m = new Map(a); function roman(number) { var div = number; var r = ""; for (var key of m.keys()) { while ((div / key) >= 1) { r += m.get(key); div -= key; } ; } //console.log(r); return r; }