WDI Fundamentals Unit 9
In this challenge, we'll be taking a look at a few cases where we have errors in our code due to variable scope. Are you ready?
1. We are getting a reference error when we try to log
"Hello Marie" to the console. See if you can move the
console.log statement to where it can access the variable
2. Each time the
scorePoint function runs, one point should be added to
total. Here we are calling the
scorePoint function three times, so the final
total should be
3. But each time the function is called,
total is being reset. Which statement could you move outside the function so that
total is set to
0 when the page first loads, but is incremented by one every time the
scorePoint function is called?
Stuck? Check out the solutions for assistance.