Homework Assignment #14: Callbacks and Promises

Objectives Create two different scripts. One will contain the callback-centered code, and the other the promises-centered code. The two scripts should contain the same functionality, and solve the same problems.

  1. Calculate the square of num and log it to the console
  2. Wait "num" milliseconds
  3. Determine the prime-number that is closest to num without being greater than or equal to num, and then log it to the console
  4. Determine the prime-number that is closest to numwithout being greater than or equal to num, and then log it to the console
  5. Count the total elapsed time from when the original function was called until the last step was completed, and log that to the console as well.

Call Back Example

Promise Example