I can explain the difference between function declarations and function expressions.
- function expressions are defined by
var name = ...are invoked withname(...)but are not hoisted. - function declarations are defined by
function name(...){...}, are invoked similarly, and are hoisted.
Rules for this:
-
thisis the global object (window, or global when in terminal)
-
thisis whatever object the function/method is being called from
-
thisis whatever you say this is.