10. First class function
• They can by passed around
• They can be assigned to variables
• They can be stored in more complex data
structure, like array or objects
www.codibly.com
25. Higher-order Function
• Abstract or isolate actions
• Async flow control using callback functions
• Promises
• Create utilities which can act on a wide variety
of data types
www.codibly.com
26. Higher-order Function - own map implementation
www.codibly.com
const arr1 = [1, 2, 3];
function mapForEach (arr, fn) {
const newArray = [];
for (let i = 0; i < arr.length; i++) {
newArray.push(fn(arr[i]))
}
return newArray;
}
const result = mapForEach(arr1,function (item) {
return item * 2
});
31. Currying - example
www.codibly.com
function multiply (a, b, c) {
return a * b * c
}
function multiply (a) {
return function (b) {
return function (c) {
return a * b * c;
}
}
}
32. What is a partial application
or partial application function