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

Added a brief note regarding function hoisting #38975

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ const myFunc = () => "value";
```

This code will still return <code>value</code> by default.

<strong>Note</strong>: Unlike the function declarations covered in the previous section, arrow functions are not 'hoisted' to the top of their scope. This means that they cannot be invoked by any code that precedes them in the source code. Because of this, arrow functions are perfectly suited to use cases like the one in the above example, but care must be taken when considering whether to use them in place of function declarations elsewhere in your code.
</section>

## Instructions
Expand Down