JSFiddle - React, Tailwind, and code Playground
JavaScript
function f1(arg1a, arg1b) {
return $.Deferred(function(dfd) {
//do something with arg1a, arg1b
dfd.resolve(arg1a * 5, arg1b * 10)
}).promise();
}
function f2(arg2a, arg2b) {
// Do something with arg2a and arg2b AFTER f1 has fully run.
console.log(arg2a, arg2b)
}
f1(1, 2)
.then(f2)
// handle errors
.catch(function(err) { // alternatively use `.fail()`
console.log(err)
})