Functions

Calling a Callback

Calling a Callback

A callback is a function passed into another function. The receiving function controls when to call it, but the caller controls what behavior it performs.

Your task: Write checkValue(value, rule) so it calls rule with value and returns the result.

Free with a JS Exercises account

Sign in to start coding, run your solution, and keep your progress saved for later. No payment needed.

By continuing, you agree to our Terms and Privacy Policy. We'll send occasional product updates and news. You can unsubscribe anytime.

Calling a Callback

A callback is a function passed into another function. The receiving function controls when to call it, but the caller controls what behavior it performs.

Your task: Write checkValue(value, rule) so it calls rule with value and returns the result.

Free with a JS Exercises account

Sign in to start coding, run your solution, and keep your progress saved for later. No payment needed.

By continuing, you agree to our Terms and Privacy Policy. We'll send occasional product updates and news. You can unsubscribe anytime.

Console

Run code to see output.