JavaScript WAIT - basic examples

Example 1

WAIT Basic example - modern async/await solution

  1. Create variable with value 10
  2. Wait 5 second
  3. Add +10 to variable
  4. Display results

Example 2

WAIT in FOR lopp - modern async/await solution (ES2015+)

  1. Create variable with value 10
  2. In FOR loop wait 5 sec - 3x
  3. Add +10 to variable
  4. Display results in loop
  5. Modern async/await solution (ES2015+)

Example 3

WAIT in RECURENT function - solution for old browsers (ES5)

  1. Create variable with value 10
  2. In RECURENT FUNCTION wait 5 sec - 3x
  3. Add +10 to variable
  4. Display results in loop
  5. Solution for old browsers (ES5)
Counting: 0 seconds