← All practice pages
JavaScript
JavaScript Functions
Functions in JavaScript are values: you can pass them around, return them, and wrap them. A higher-order function is simply one that takes or returns another function.
Try it now
Write a higher-order function "once(fn)" that returns a wrapped function which runs fn only on its first call and returns the cached result thereafter.
Create a free account to run your answer and get ARIA's review.