JSFiddle - React, Tailwind, and code Playground

by nerdycap007

JavaScript

/* f(1)(2)(3); //9
f(2)(2)(1); //4
f(2)(2)(1); //4
f(); */

function f(a, b, c) {

  if (a && b && c) {
    return (a + b) * c
  } else {
    return function(b1) {
      return function(c1) {
        return (a + b1) * c1
      }
    }
  }
}

console.log(f(1, 2, 3))