Skip to content

Instantly share code, notes, and snippets.

@DynamiteC
Created August 12, 2018 10:35
Show Gist options
  • Save DynamiteC/908c0ccb4c65ae55f644e854eba4a88a to your computer and use it in GitHub Desktop.
Save DynamiteC/908c0ccb4c65ae55f644e854eba4a88a to your computer and use it in GitHub Desktop.
Thinkful_Scope_And_Globals
What is scope?
Scope is what we say something that is only accessible to the current block. so when we say a global scope that says us that this would accessible throughtout the code while local scope would be accessible to the only block where it was defined.
Why are global variables avoided?
Main reason behind the avoiding the global variables is that when in need of the updated global variable it might not be one we're looking for.
Explain JavaScript's strict mode.
Strict Mode is use so that the code throws more exceptions and certain actions are also prevented from doing stuff they are meant to do.
What are side effects, and what is a pure function?
Side Effects are something that modifies some state outside their scope. A pure function is something that returns same arguments as the they are passed in.
Explain variable hoisting in JavaScript.
A Varible hoisting would mean that it can be declared again even after its already used.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment