Implement a while loop that continuously prompts the user to enter a color. If the color entered matches a CSS property such as blue
, red
, or #000000
:
The background will change accordingly, but if the user enters an incorrect color, a message will be displayed.
var chosenColor = prompt("Enter a color: ");
while (chosenColor === document.body.style.backgroundColor){
document.write("The color has been changed");
}