Skip to content

Latest commit

 

History

History
 
 

project-javascript-g1-iterators

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

PROJECT JAVASCRIPT G1 Iterators

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>
<html>
  <body>
    <script>
      // your code here
    </script>
  </body>
</html>
  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: https://codingwithbasir.com/how-to-deliver-projects/

Need help?

Download Learn JavaScript eBook from https://codingwithbasir.com/learn-javascript