Functions that are passed into another function to decide the invocation of that function.
Function that
- can be assigned to a variabled
- passed into another function
- returned from another function
Functions that
- take a function as an argument
- return a function
A function that is
- passed in another function
- returned from another function
users.map(user => user.name)
- element
- index
- array
array.slice(inclusiveStartIndex, exclusiveEndIndex)
array.slice()
Iterates over each item in array and returns single value
// reduce(callback, initialValueOfAccumulator)
users.reduce((sum, user) => sum + user.age, 0)
-
accumulator
- assigned return value of callback
-
element
-
index
-
array
Unicode point value
Yes :(
Array.prototype.every
Array.prototype.some
Its arity
Convert a function of N arity into N functions of arity 1.
//Curried function
function curried(x) {
return function(y) {
return x + y;
}
}
Applying a few arguments to a function at a time and returning another function that is applied to more arguments.
//Impartial function function impartial(x, y, z) { return x + y + z; } var partialFn = impartial.bind(this, 1, 2); partialFn(10); // Returns 13