Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Topics: Functions as Data, Functions as Parameters

Project Title: Functions Benchmark

  1. Open VS Code and create a html file with your name like john.html
  2. Add current code to that file:
<!DOCTYPE html>
      // your code here
  1. Declare function repeat(func, param, times) that takes a function func, a paramter for the function param and number of calls times. It should call the function with that parameter for requested times and log run number into console.

  2. Declare function repeatDuration(repeat, times, func, param) that takes a repeat function repeat, times of calling times, function to be called func and parameters to this function param. It should call the function and log its running time in milliseconds.

  3. define function factorial that gets a number and return its factorial and logs it into console.

  4. Call repeatDuration to log running time of factorial for parameter 20 for 1000 times.

Want to get reviewed?

Send Pull Request. Check how to deliver your code:

Need help?

Download Learn JavaScript eBook from

You can’t perform that action at this time.