JSFiddle - React, Tailwind, and code Playground

HTML

<script src="https://raw.github.com/kriskowal/q/master/q.min.js"></script>

JavaScript

var deferred = Q.defer();
var promise = deferred.promise;

['first', 'second', 'third'].forEach(function (position) {
  promise.then(function () {
    alert(position);
  });
});

deferred.resolve();