In JavaScript, when you call a function with arguments, the arguments you're passing are passed by value, not by reference. When a new function is created, it looks around for all the variables it has access to and "closes over" them to form a "closure" This means that so long as this logger function exists, it will have access to the variables in its parent's function.
3 Comments
Sort: