I can explain the difference between function declarations and function expressions.
- Function declarations do not declare
var
with a name before the function prior to the function keyword like function expressions do. With the expression, you cannot make a call to a function that is declared later in the file or it will throw an error because only thevar
part is hoisted to the top of the file, but the value of that (which is going to be a function) is still undefined. All function declarations (named functions) will be hoisted to the top of the file, so you can use them even before you actually defined them in the file.
I can explain what the value of this
is in a normal function.
- global window
I can explain what the value of this
is when called from the context of an object.
- the object