0

Write a sum method which will work properly when invoked using either syntax below.

console.log(sum(2,3)); // Outputs 5 console.log(sum(2)(3)); // Outputs 5

8th Sep 2018, 12:49 PM
Miguel Angel Acosta
Miguel Angel Acosta - avatar
1 Réponse
0
I don't think the second line is possible. Maybe you could write something like sum(2)[3] but it would be very wrong and stupid
8th Sep 2018, 5:47 PM
Daniele Bonomi
Daniele Bonomi - avatar