Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

To make the "you" and "we" more consistent. #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions resources/1-Javascript-General-Topics/functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

### Scope and Closure

* When you first start writing a program in JS, you are in the `Global Scope`. If we define a variable, it will be defined globally.
* When we first start writing a program in JS, we are in the `Global Scope`. If we define a variable, it will be defined globally.
```javascript
const number = 1;
```
We generally want to avoid globally scoped variables as you can very quickly run into namespacing issues.
We generally want to avoid globally scoped variables as we can very quickly run into namespacing issues.

* A local scope refers to any scope defined inside the global scope. Each function defined has its own local scope.
```js
Expand All @@ -32,7 +32,7 @@ Locally scoped items are not available to the global scope.
### Anatomy of a function

When we approach a function, one of the most valuable abilities is to comfortably understand what the goals
and the use cases of a function are. This can be difficult when a function is not named well, however eventually
and the use cases of a function are. This can be difficult when a function is not named well. However, eventually,
even a poorly named function can be parsed by someone with enough experience and knowledge - for example:

```js
Expand Down Expand Up @@ -86,7 +86,7 @@ function multiplyNumberByTen(aNumber){
}
```

Now this might start to look a bit intimidating, but let's break it down and demystify. We have an expression being passed into
Now, this might start to look a bit intimidating, but let's break it down and demystify. We have an expression being passed into
a function call it looks like! Not only that, part of the expression is a function itself - how does this all work, what is the order?

Well, one thing to remember, is that before any variables or expressions are passed into a function as an argument, they need to be resolved
Expand Down