Promises
When a handler function returns a value, it is passed as an argument to the next handler(s) in a chain:
let addOne = (x) => {
return x + 1;
};
Promise.resolve(0)
.then((x) => addOne(x))
.then((x) => addOne(x))
.then((x) => addOne(x))
.then((x) => {
console.log(x);
});
// 3