JSFiddle - React, Tailwind, and code Playground

HTML

<script src="//code.jquery.com/jquery-1.12.4.js"></script>

JavaScript

var array_res = [];
array_res.push(promiseResolve('a'));
array_res.push(promiseResolve('b'));

$.when.apply(null,array_res).always( function ( ) {
  console.log(array_res);
	console.log(arguments);
  var args = Array.prototype.slice.call(arguments);
  array_res.forEach( function ( promise ) {
    if (promise.state() == 'resolved') {
      console.log('resolved');
      console.log(args);
    }
    else if (promise.state() == 'rejected') {
      console.log('rejected');
      console.log(args);
    }
  })
})



function promiseResolve (c) {
	var promise = $.Deferred();
  promise.resolve({a:c});
  return promise;
}

function promiseReject (c) {
	var promise = $.Deferred();
  promise.reject({b:c});
  return promise;
}