I need to change my coding so that it only converts numbers from 1-50 but cannot get it to work as my code allows users to type in numbers above this and it produces a number. Please can you help??
function converter(e){
var t = drawNumerals;
var a = [[50,'L'],
[40,'XL'],[10,'X'],
[9,'IX'],[5,'V'],[4,'IV'],[1,'I']];
for (var i = 0; i < a.length; i++){
while (e - a[i][0] >= 0){
t(a[i][1]);
if (a[i].length == 3){
t(a[i][2]);
}
e -= a[i][0];
}
}
}
Bookmarks