Tell us what’s happening:
Ok for the certification i have done here
Your code so far
<!-- file: index.html -->
<!-- file: index.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="styles.css" />
<title>Roman</title>
</head>
<body>
<div id="output">
<label for="number"
>Arabic to Roman Numerals<input
type="number"
name="arabicNumeral"
id="number"
min="0"
max="3999"
step="1"
placeholder="Enter an integer between 0 and 3999"
/>
</label>
<hr />
<button type="button" id="convert-btn" onclick="convertToRoman()">
Convert
</button>
<button type="button" id="display"></button>
</div>
<br><br><br>
<div class="reset" id="reset">
<button type="button" id="reset-btn" onclick="resetResult()">
Reset
</button>
</div>
<script src="script.js"></script>
</body>
</html>
/* file: styles.css */
/* file: styles.css */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
/* Input element with id "number" */
#number {
padding: 10px;
margin: 0 auto;
border: 2px solid #eee;
box-shadow: 0 0 15px 4px rgba(0, 0, 0, 0.06);
border-radius: 10px;
width: 100%;
font-size: inherit;
}
/* Button element with id "convert-btn" */
#convert-btn {
padding: 10px;
background-color: #3f51b5;
border: none;
margin: 0 auto;
color: #fff;
font-weight: 600;
border-radius: 5px;
width: 100%;
}
/* Div element with id "output" */
#output {
padding: 10px;
border: 1px solid gray;
box-sizing: border-box;
width: 90%;
margin: 0 auto;
text-align: center;
font-weight: 600;
color: #4f51b1;
}
/* Div element with id "reset" */
#reset {
padding: 10px;
border: 1px solid gray;
box-sizing: border-box;
width: 90%;
margin: 0 auto;
text-align: center;
font-weight: 600;
color: #4f51b1;
}
/* file: script.js */
function convertToRoman(num) {
let romanNumeral = " "
let romanList = [
['M',1000],
['CM',900],
['D',500],
['CD',400],
['C',100],
['XC',90],
['L',50],
['XL',40],
['X',10],
['IX',9],
['V',5],
['IV',4],
['I',1]
]
for (let i = 0; i < romanList/length;i++){
while(num>=romanList[i][1]){
romanNumeral += romanList[i][0]
num -= romanList[i][1]
}
}
}
convertToRoman(3609);
the code deosnt pass exceppt for the first three the rest all it show xmen x
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36
Challenge Information:
Build a Roman Numeral Converter Project - Build a Roman Numeral Converter