The Delegator
Medium+30 XP
Mission Briefing
You've been handed a volatile energy core and an activation protocol! You must carefully execute the protocol, feeding it the energy core to see what happens.
The Concept: Callbacks
A Higher-Order Function (HOF) is simply a function that accepts another function as an argument. The function passed in is called a "callback".
To execute the callback, you literally call it using its parameter name inside your function!
Example: function doTask(cb) { return cb(5); }
The Objective
Your function receives a value and a callback function.
- Execute the
callbackfunction and pass it thevalueas its argument. - Return whatever the callback returns.
01EXAMPLE 1
Input
value = 10, callback = (x) => x * 10Output
100Constraints
- Execute the callback directly.
AdvancedFunctions
JavaScriptSystem handles I/O — write your function only
Loading...
3 Hidden
Input Arguments
value10
callback"___FN___:return function(x){return x * 10}"
Expected Output
100
Click RUN to test your solution