← Back to challenges

All About Anonymous Functions: Adding

JavaScriptHardlanguage_fundamentalshigher_order_functions

Instructions

Write a function that returns an anonymous function, which adds n to its input

Examples

adds1 = addsNum(1)

adds1(3) ➞ 4
adds1(5.7) ➞ 6.7

adds10 = addsNum(10)

adds10(44) ➞ 54
adds10(20) ➞ 30

Notes

N/A

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Promises I: What Is a Closure?