I was testing some currying-in function and I could get this to work pretty easily:
test = (a) => { return (b) => a+b } // test(5)(6) => 11
I couldn't get to work the same function when using the ES6 destructing argument:
test = ({a}) => { return (b) => a+b } // test(5)(6) => NaN
Is there a way to have it work? Why doesn't the second test function work?
If you use a destructuring argument, you have to call your function with an object :