JavaScript Webpage Workout - M1 Lesson 4 exercise 4
August 13, 2020
This exercise follows Lesson 4 exercise 3. Please do that exercise first for this exercise to make more sense or start from Lesson 1 if this is your first time to the course.
📺 This Lesson 4 Exercise 4 is also available as a video.
Exercise in Toggling an answer in a game.
Exercise 4 will toggle between showing and hiding the answer for a game or quiz. Here’s what you should build.
- Create a mock question HTML element for your quiz/game.
- Create the answer HTML element for that question that is hidden using CSS.
- Create a button that when clicked will reveal the answer.
- Create a “next question” button or icon that when clicked hides the answer.
Remember to keep the C-A-M-E-L work sequence in mind, especially when you find yourself wondering what to do next. Ask yourself, “Have I created all the elements I need for this project? Am I accessing the elements I need to manipulate and the elements that will have listeners attached to them via JavaScript? Which element when clicked does what? The what will define your event handler functions.
You can compare your work with mine here at CodePen or watch the video.
Lesson 4 Exercise 4
Keeping practicing by going on to Lesson 4 exercise 5.