Skip to content

Commit

Permalink
Typo Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pathway27 committed Jul 3, 2015
1 parent 30a5b35 commit 7027e71
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion up & going/ch2.md
Expand Up @@ -747,7 +747,7 @@ fred.login( "fred", "12Battery34!" );

The `User()` function serves as an outer scope that holds the variables `username` and `password`, as well as the inner `doLogin()` function; these are all private inner details of this `User` module that cannot be accessed from the outside world.

**Warning:** We are not callling `new User()` here, on purpose, despite the fact that probably seems more common to most readers. `User()` is just a function, not a class to be instantiated, so it's just called normally. Using `new` would be inappropriate and actually waste resources.
**Warning:** We are not calling `new User()` here, on purpose, despite the fact that probably seems more common to most readers. `User()` is just a function, not a class to be instantiated, so it's just called normally. Using `new` would be inappropriate and actually waste resources.

Executing `User()` creates an *instance* of the `User` module -- a whole new scope is created, and thus a whole new copy of each of these inner variables/functions. We assign this instance to `fred`. If we run `User()` again, we'd get a new instance entirely separate from `fred`.

Expand Down

0 comments on commit 7027e71

Please sign in to comment.