Coding Challenge: Changing Colors

Let's cover an exercise related to keyboard events, see if you can solve it on your own!

We'll cover the following

Problem statement

Given below is some HTML code to start with.

Write the associated JavaScript code that updates the background color of all div tags according to the key (R, Y, G, or B) pressed by the user.

If you get stuck, you can refer to the given solution.

Get hands-on with 1400+ tech skills courses.