Currying function

by Ting-Yuan Chang

JavaScript

function add(num1) {
  return function(num2) {
    console.log(num1 + num2);
  };
};

add(1)(2)