From the course: Building Website Interactivity with JavaScript

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Solution: Finalizing the basic gameplay

Solution: Finalizing the basic gameplay - JavaScript Tutorial

From the course: Building Website Interactivity with JavaScript

Solution: Finalizing the basic gameplay

(upbeat music) - [Instructor] Let's take a look at my solution to this final challenge. Okay, enter in some letters here. So this was not a valid word, so I'm told to try again. Okay, fine, I'll try again. There we go. So you can see these success and error messages are differentiated. The good job is in larger friendlier letters, and it's bold, and everything is otherwise working. Starting with the HTML file, I've hard coded the messages in here since there's no need for them to change per solution. Then in the CSS file, I'm styling each of these with just some different colors and a little bit larger, bolder type, when the solution is correct. Then in the script, there's a couple of things to note. First of all, in order to figure out whether a solution is correct, I need to know how long a solution can be. Instead of hard coding that as the number four, I'm getting the length of a query selector all on the slots. That way if I decide later to change the number of slots, I don't…

Contents