21 lines
463 B
JavaScript
Executable File
21 lines
463 B
JavaScript
Executable File
let div = document.getElementById("did-you-get-it-right-or-wrong")
|
|
let number = Math.round(Math.random() * 16777216)
|
|
let hex_number = number.toString(16)
|
|
|
|
document.body.style.background = `#${hex_number}`;
|
|
console.log(hex_number)
|
|
|
|
setTimeout(finish, 1000)
|
|
|
|
function finish() {
|
|
let input = prompt();
|
|
|
|
if (input == hex_number) {
|
|
div.innerHTML="CORRECT"
|
|
console.log("Correct")
|
|
} else {
|
|
div.innerHTML = `No, it was ${hex_number}`
|
|
console.log("Nope!")
|
|
}
|
|
}
|