Created
July 5, 2018 23:59
-
-
Save aquaductape/4def3aa210aecf81a67ef42c268d89c2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. What is scope? | |
Scope is where the variable can used. A variable declared globally means that it can accessed everywhere including in local scopes | |
such as functions or conditional statements. | |
2. Why are global variables avoided? | |
Global variables will overwrite other variables with the same binding name in local scopes such as functions. This will lead to | |
unintended results. To avoid this, inside the function, redeclare that binding name so that it is set in that local environment. | |
3. Explain JavaScript 'strict mode' | |
It prevent binding names that are not set with var, let, or const to be declared globally. | |
4. What are side effects, and what is a pure function? | |
Any function that modifies anything that is out of its scope is a side effect and pure function always return the same result | |
given the same parameters. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment