One line of javascript. What is this?

One line of javascript. What is this?
0

#1

Its one of the unit tests for the “Arguments Optional” challenge in the Front End Development Certification course. Pretty standard, the student writes the body of a function called by the unit test.

Last unit test function call looks like this:

addTogether(2)([3])

What is the second paren? Looks like a syntax error to me, but the interpreter doesnt mind. What am I missing?


#3

This syntax is valid. This is called currying. Basically the function returned from addTogether(2) is immediately called with [3] as an argument.