JSFiddle - React, Tailwind, and code Playground

by Константин Дралюк

JavaScript

var wait = {
  for: function(time) {
    this.time = time;
    return this;
  },
  then: function(func) {
    setTimeout(func, this.time);
  }
};

wait.for(1000).then(function(){
	alert('1s gone!')
});
wait.for(2000).then(function(){
	alert('2s gone!');
});