up
This commit is contained in:
parent
4ae129054e
commit
ab9ab64bd5
476 changed files with 3370 additions and 532 deletions
|
@ -0,0 +1,17 @@
|
|||
importance: 2
|
||||
|
||||
---
|
||||
|
||||
# Sum with an arbitrary amount of brackets
|
||||
|
||||
Write function `sum` that would work like this:
|
||||
|
||||
```js
|
||||
sum(1)(2) == 3; // 1 + 2
|
||||
sum(1)(2)(3) == 6; // 1 + 2 + 3
|
||||
sum(5)(-1)(2) == 6
|
||||
sum(6)(-1)(-2)(-3) == 0
|
||||
sum(0)(1)(2)(3)(4)(5) == 15
|
||||
```
|
||||
|
||||
P.S. Hint: you may need to setup custom object to primitive conversion for your function.
|
Loading…
Add table
Add a link
Reference in a new issue