a guest Oct 18th, 2017 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- What is scope?
- code it is in the global scope. Declared variables here are defined globally. The local scope lives inside of functions
- and each function, included nested functions, have their own local scope; however, any function defined within other
- functions will have linked scopes - inner local scopes are linked outwardly.
- Why are global variables aviod?
- Global variables can some code to be indeterminate (returns different values at times) which makes tracking down bugs
- What is strict mode?
- eliminates some sillent errors and changes them into throw errors. It also fixes mistakes that make it difficult for
- enacted by witing the command 'use strict;' at the top of the file for global control or at the top of a function for
- local control.
- What are side effects, and what is a pure function?
- A side effect is when a functions is able to reach outside of its local scope to change values in other areas of
- the code. A function is "pure" when it is determinate (returns the same value consistently with the same set of inputs)
- and cuases no side effects in the proram overall.
RAW Paste Data