跳轉到

Functional Programming

Pure Function

always gives the same return value for the same arguments.

the function cannot depend on any mutable state.

Higher-order Function

functions that accept a function as an argument and return a function.

Currying

breaks down a function that takes multiple arguments into one or multiple levels of higher-order functions.

const add = (a) => {
  return (b) => {
    return a + b;
  };
};

const add1 = add(1);
const add2 = add(2);