you are viewing a single comment's thread
view the rest of the comments
[–] 75 points 1 year ago (4 children)

The output is sorted due to the fact that for each number, a timer is started that prints out the number after waiting a number of milliseconds equal to said number.

Therefore, 1 is printed first after delaying for 1 millisecond, 5 is printed second after 5 milliseconds etc.

  • source
  • parent
  • hideshow 4 child comments
  • [–] 4 points 1 year ago (2 children)

    So all items in the array are launched simultaneuously and ran in parallel instead of sequentially?

  • source
  • parent
  • hideshow 2 child comments