Javascript Functions (Day 2)
# Javascript Functions (Day 2)
# What are the three ways to syntactically write a function? What are the differences in how the function acts (if any)?
The first method is Function Declaration, which is when you type function followed by a name. This makes it hoisted which allows the function to be used before it's defined. The second method is to write a Function Expression. These can be used to define a named or anonymous function which cannot be used before they are defined. The last method is by creating an Arrow Function which is shorter syntax, however they don't create their own this value.
# What is the difference between Parameters and Arguments?
Parameters are used when defining a function meanwhile arguments are used when the function is invoked following those parameters.
# What are higher order functions? Can you provide an example?
Higher order functions are when a function accepts another function as a parameter, or returns a function. An example might be something such as an Arary.prototype.map or array.prototype.filter.