Skip to content

Instantly share code, notes, and snippets.

@mzibari
Last active January 20, 2020 04:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mzibari/f20b92416a352e669235cc8717812fb9 to your computer and use it in GitHub Desktop.
Save mzibari/f20b92416a352e669235cc8717812fb9 to your computer and use it in GitHub Desktop.
Answers to assignment questions
Scope is the accessibility to a vairable in different parts of the program. Global variables can be accessed anywhere in the program, while block variables can only be accessed within that particular block that they're declared in.
Global variables should be avoided, except in specific cases, because they will cause unintended side effects that will cause bugs, especially in larger programs, that will be hard to track down.
Strict mode will trigger an uncaught reference error any time a variable is declared without 'let' or 'const' keywords, it's used to stop the accidental creation of indeteminate code.
Side effects are the accidental alteration of a global variable's value that will effect the outputs of a different function or a block of code. Pure function is a function that when provided with the same inputs will always have the same outputs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment