Skip to content

Instantly share code, notes, and snippets.

@jeffreymahmoudi
Created February 24, 2018 06:07
Show Gist options
  • Save jeffreymahmoudi/cfe7ef40a6f2d9b1c5d694dfb9a56811 to your computer and use it in GitHub Desktop.
Save jeffreymahmoudi/cfe7ef40a6f2d9b1c5d694dfb9a56811 to your computer and use it in GitHub Desktop.
What is scope?
Scope defines how variables can or cannot be accessed in different places in code. Global scope allows all code to use the variable while block scope is restriced to the block it is defined in.
Why are global variables avoided?
Global variables can cause side effects like causing a function to become indeterminate.
Explain JavaScript's strict mode.
Strict mode forces all functions to use let or const when defining a variable.
What are side effects, and what is a pure function?
Side effects can include unintentionally changing a variable's value or changing a value a function is relying on. A pure function is both determinate and has no side effects.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment