When learning JavaScript, one of the first concepts that confuses almost every beginner is scope. You write a variable in one place, try to use it somewhere else, and suddenly JavaScript throws an error saying the variable is not defined.
Why does t...