-
Functions are Values => First Class Function Programming
-
Less Codes Always means Less Bugs
-
Good Functional Code is made up of small Functions that do one thing and are chained/bind together
-
In JavaScript, Functions are also Closures. The Function Body has ACCESS to Variables that are Outside of It
-
Functions that take other Functions as their Arguments are called Higher Order Functions
-
HOF Filter is a Method on the Array Object that takes another Function as its Arguments and uses that Function to Filter the Array
-
HOF Map will take an Array and return a new Array of the same length but with each individual Item Transformed
-
HOF Reduce is extremely powerful List Transformation that it can replace all of the HOFs including Filter, Map, Reject, Find...
-
Reduce Method will take a Callback Function and an Object (as a Starting Point) as its' Arguments
-
Currying is when a Function doesn't take all of its Arguments upfront. A Curry Function has to call all the Arguments of its' Partial Functions. Eg:
function multiply(a) {
return (b) => {
return (c) => {
return a * b * c;
};
};
}
// ES6:
const multiplyES6 = (a) => (b) => (c) => a * b * c;
console.log(multiply(1)(2)(3)); // 6
console.log(multiplyES6(1)(2)(3)); // 6- Recursion is when a Function calls itself until it doesn't
- Always think about what you are doing, what your END GOALS are.
- Do not start Coding too early, think about the process & result.
- Use liveServer to open
home.html - Add a JS file into the
script srcinsidehome.html - Use
inspectorto test theconsole.logresult
- ZTM Github Link: https://github.com/aneagoie/ztm-master-the-coding-interview-ds-algo