Nomral function

const addTwoNumbers = (num1, num2) => num1+num2
addTwoNumbers(1,2); // 3
addTwoNumbers(1,3); // 4
addTwoNumbers(1,4); // 4

Currying

Currying works by creating a function, which accepts partial information and then returns another function which accepts the rest of the information and has a reference to the originally passed in partial information.

const addTwoNumbers = (num1) => (num2) => num1 + num2
addTwoNumbers(1)(2); // 3
addTwoNumbers(1)(3); // 4

In the curry style above we are passing information as it becomes available. First we passed in the first number, then we passed in the second number. An intersting use case for this is when part of the information is the same everytime, so then you have a half baked, custom function. for instance in this case lets say the first parameter is to alawys be 1, then in that case we can get a custom function.

const addTwoNumbers = (num1) => (num2) => num1 + num2
const addYourNumberToOne = addTwoNumbers(1);
addYourNumberToOne(2); // 3
addYourNumberToOne(3); // 4