From the course: Coding for Visual Learners: Learning JavaScript from Scratch
Unlock this course with a free trial
Join today to access over 24,400 courses taught by industry experts.
Player feedback - JavaScript Tutorial
From the course: Coding for Visual Learners: Learning JavaScript from Scratch
Player feedback
- [Instructor] To be able to give feedback to the user on how they're doing in the game, we will start storing their score. We will make use of the stored data to make the game stop after set amount of correct or wrong guesses. To be able to do so, I will start off by creating a global variable here, an array that is initially a empty. And inside the keyPressed function, for every solution that has the value true, I'm going to push the value true inside the results array. And for every false value, I'm going to be pushing the value false into this array. And now if I'm to console.log the value of the results variable inside the draw function, I can see that it is initially empty. But if I'm to make a wrong guess, it's going to get a false value inside. And if I'm to make another wrong guess, it will get another false. And if I'm to make a correct guess here, it's going to get a true inside itself. We should also…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.