JSFiddle - React, Tailwind, and code Playground

HTML

<div id="shape">1</div>
<div id="shape2">2</div>
<div id="shape3">3</div>
<div id="shape4">4</div>

CSS

#shape,
#shape2,
#shape3,
#shape4 {
  background-color: #00BFFF;
  width: 100px;
  height: 100px;
  top: 0;
  position: relative;
  display: inline-block;
  transition: top 1s
}

JavaScript

let foobar;

let lala = new Promise(function(resolve, reject) {
  $("#shape").css({
    top: 100
  });
  setTimeout(function() {
    resolve();
  }, 1000);
}).then(function() {
  return new Promise(function(resolve, reject) {
    $("#shape2").css({
      top: 100
    });
    setTimeout(function() {
      resolve();
    }, 1000);
  });
}).then(function() {
  foobar =  new Promise(function(resolve, reject) {
    $("#shape3").css({
      top: 100
    });
    setTimeout(function() {
      resolve();
    }, 1000);
  });
  return foobar;
});

lala.then(function() {
  console.log("checking:", lala, foobar, lala === foobar);
  return new Promise(function(resolve, reject) {
    $("#shape4").css({
      top: 100
    });
    setTimeout(function() {
      resolve();
    }, 1000);
  });
});