What is scope? Your explanation should include the idea of global vs. local scope.
Scope is what defines the kind of access each part of code has to a variable. A variable in the global scope is available everywhere in your code. It can be changed by other parts of your code and this will affect other functions that are accessing that variable. Global scope also spans across files. Variables created inside a function have local scope. This means that they are only accessible within the function's block of instructions. When the function has finished executing, this new variable disappears. The variables created inside a function will not affect global variables.

Why are global variables avoided?
Global variables tend to make unintended side effects in a program more likely to occur. When you combine global variables and unintended side effects, you get indeterminate code. Indeterminate code means that even when given the same inputs your results can vary. This can cause your code to become buggy and hard to fix.


Explain JavaScript's strict mode
Strict mode is a command that can be put in the top of a JavaScript file or function. When this command is enabled, anytime a variable is declared without the var keyword, an error will be generated. It's best practice to put 'use strict'; at the top of all your JavaScript files.


What are side effects, and what is a pure function?
A side effect is when a function reaches outside its local scope, and changes a value in a parent scope. Unintended side effects result in indeterminate functions which create bugs in your code. A pure function is one that is determinate and has no side effects. A function is determinate when it always returns the same value when given the same inputs. You should strive to always write pure functions.

Explain variable hoisting in JavaScript.
Hoisting describes the way the JavaScript interpreter initially declares variables when it reads through the code of your file. The interpreter does an initial pass through of your code, finding every variable declaration within a given scope, and moves it to the top of that scope. It then once again passes through the code executing it line by line. Function declarations also get moved or hoisted to the top, which is why you can call functions before you declare them in your code.