JSFiddle - React, Tailwind, and code Playground

HTML

<div id="output"></div>

JavaScript

function out(msg)
{
  $('#output').append(msg + '<br>');
}

var myDeferred = [];
$.each([8, 3, 4, 6, 9, 15, 7, 1], function (index, time)
{
  myDeferred.push($.Deferred(function(dfd)
  {
    setTimeout(function ()
    {
      //out(time);
      dfd.resolve(time);
    }, time * 100);
  }).promise());
});

$.when.apply($, myDeferred).then(function ()
{
    $.each(arguments,function(_, time){
        out(time)
    })
    console.log(arguments)
  out('all is done');
});