Closed Jeremy-Glover closed 8 years ago
@Jeremy-Glover pretty good so far:
on 2 you have changed the output and functionality of the example. When rewriting without hoisting the only thing that should be moved is the variable declaration, you have made it so that the test
function is using the global flag
variable not one scoped into the function.
Watch out for things like this and you should be well on your way!
JavaScript Hoisting Worksheet
Instructions
a. Review each code snippet below. b. Fill in what will be output to the console. c. Run the code to see if you were correct. d. Describe why the code behaved as it did. e. Re-write the code snippet to maintain the same output, but to avoid hoisting.
1
2
3
4
5
6