I have to convert from decimal to binary and it requires at least 3 functions and it has to be displayed in HTML. This is what I've got so far and can't figure out how to make it display properly?
// Prompt user for number between 1-1000
let input = parseInt(prompt("Enter a number between 1 and 1000", "50"));
function store() {
let quotient = [];
let answer = quotient.reverse();
return answer;
}
function check() {
while (input != 0) {
if (input < 1000 && input % 2 != 0) {
return quotient.push("1");
input = input / 2;
}
else if (input < 1000 && input % 2 == 0) {
return quotient.push("0");
input = input / 2;
}
}
}
function display() {
document.getElementById("displayNumber").innerHTML = answer;
}
display();
<h1 id="displayNumber"></h1>