From the course: JavaScript Code Challenges: Creating Web Apps
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
Quick overview of the necessary JavaScript concepts - JavaScript Tutorial
From the course: JavaScript Code Challenges: Creating Web Apps
Quick overview of the necessary JavaScript concepts
- [Instructor] Before we dive into our virtual pet's emotional rollercoaster, let's do a super quick refresher on the JavaScript we'll be using. We'll be using what we already used in the Pomodoro timer module. Most of what we need was actually already covered, so that's good. We're going to be accessing the DOM with getElementById, we're going to be using addEventListener to react to button clicks, we're going to be writing functions to organize our code, and we'll update the UI based on the internal state. These are all things we'll need here as well. There is one new little trick worth pointing out though. We'll use math.min and math.max to make sure our pet's stats, like hunger and happiness, stay within a healthy range. And this will be wrapped in a helper function. And this helper function basically says, hey, now we're going above this and this threshold. So, you can see an example. So, here's a function, clampstat, and we're using the math.max and the math.min to go ahead and…
Contents
-
-
-
-
(Locked)
Introduction: Virtual pet59s
-
(Locked)
Planning the features1m 27s
-
(Locked)
Creating the UI2m 51s
-
(Locked)
Quick overview of the necessary JavaScript concepts1m 25s
-
Taking care of the virtual pet5m 37s
-
(Locked)
Adding the game loop2m 34s
-
(Locked)
Final touches5m 34s
-
(Locked)
Challenge: Getting a health report51s
-
(Locked)
Solution: Getting a health report2m 1s
-
(Locked)
-
-
-
-