Home > Enterprise >  How to create the function to give that result
How to create the function to give that result

Time:04-16

The function that will take over all the arguments needs to be created, and I don't understand what part of [1].a(3)

const add = () => {

}
add(1)(2)[1].a(3) // 1 2 3 = 6

CodePudding user response:

const add = (first) => {
  return (second) => {
    return [
      undefined,
      {
        a: (third) => first   second   third
      }
    ];
  }
}

let result = add(1)(2)[1].a(3);
console.log(result);

:)

  • Related