javascript-questions icon indicating copy to clipboard operation
javascript-questions copied to clipboard

Q.123 - Currying

Open mbtestfeed opened this issue 5 years ago • 1 comments

https://github.com/lydiahallie/javascript-questions#123-whats-the-output

Probably just a point of pedantry, but the function

const add = x => y => z => {
  console.log(x, y, z);
  return x + y + z;
};

will log 4 5 6 with the given input (4)(5)(6), so the answer of A is correct. However at the end of the explanation it states that "This returns 4 5 6." The function should return 15, but the log output will be as stated. I'm unsure if this level of pickiness is really worth fixing, but figured I'd raise it to see if anyone else cares about this.

On a similar note of "not sure if worth a change", it might be worth referring to this by the name of "Currying" so that readers can look more into it, where else it gets used, and why it's useful if they want to. Thoughts?

mbtestfeed avatar Jun 29 '20 03:06 mbtestfeed

I support the same @jakeherp

web20opensource avatar Feb 02 '21 01:02 web20opensource