Tell us what’s happening:
For this project, my plan is to first make it so that the output is the same as the number input, and then use the replace() function in some way to change the number inputs to roman numerals. Thoughts on if this is a good idea?
Your code so far
<!-- file: index.html -->
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<input id="number" type="number"></input>
<button id="convert-btn">Convert</button>
<div id="output"></div>
<script src="script.js"></script>
</body>
</html>
/* file: script.js */
const convertBtn = document.getElementById("convert-btn");
const output = document.getElementById("output");
const input = document.getElementById("number");
const inputFunc = () => {
if (input.value === "") {
output.innerText = "Please enter a valid number";
} else if (input.value === "-1") {
output.innerText = "Please enter a number greater than or equal to 1";
} else if (input.value >= "4000") {
output.innerText = "Please enter a number less than or equal to 3999";
} else {
output.innerText === input.value;
}
}
convertBtn.addEventListener("click", inputFunc);
/* file: styles.css */
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.3 Safari/605.1.15
Challenge Information:
Build a Roman Numeral Converter Project - Build a Roman Numeral Converter