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.

  1. Execute the callback function and pass it the value as its argument.
  2. Return whatever the callback returns.

01EXAMPLE 1

Inputvalue = 10, callback = (x) => x * 10
Output100

Constraints

  • Execute the callback directly.
AdvancedFunctions
JavaScript
Loading...
3 Hidden

Input Arguments

value10
callback"___FN___:return function(x){return x * 10}"

Expected Output

100

Click RUN to test your solution