Another simple app that changes the background color of elements clicked on
is a developer, technical writer, and a (former) designer.
Image by CodingExercises
What we’ll be building
Here’s the code:
document.body.style.background = "yellow"
Obviously, running this code will change the background of the
body element of our page.
We can further improve this by getting the color as an input from the user, using the
var givenColor = prompt('Type in an HTML named color (such as orange, green, blue, etc.'); document.body.style.background = givenColor;