It’s important to understand the differences between local scope, global scope and block scope. Variables are considered local scope if they are inside a function. Those outside the function are global. Variables in local scope can have a different scope for each call of that function. Variables of the same name can be used for multiple functions.
Value vs. Reference
There are three types of data which are copied by having their reference copied, that’s Array, Object, and Function. These are technically Objects.
Higher Order Functions
Prototypes and Inheritance
Variable and function declarations are what’s called hoisted (lifted and declared) to the top of their available scope, if defined in a function, at the top of the global context or outside a function.
Function expressions are not hoisted, only variable declarations, so not variable initialization or assignments. As it takes precedence, function declaration will override a variable declaration when hoisted.
‘Apply,’ ‘Call,’ ‘Bind’
These methods are different only slightly, and it can be hard to remember which function does what. ‘Call’ invokes the function while allowing you to pass in arguments one at a time. ‘Apply’ also invokes the function but allows you to pass in arguments as an array. And finally, ‘bind’ returns a new function, allowing you to pass in a ‘this’ array and any number of arguments.
Phil is Aspirant's Managing Director of the App Development & Integration practice with a focus on providing enterprise-grade solutions. His 30 years of experience have given him the opportunity to work across many markets, industries, and applications. Phil is leading a team of skilled web and mobile developers building strategic solutions for our customers.