Each .then() returns a new promise. If you return a value, the next .then() receives it. If you return a promise, the chain waits for it.
getUser(1)
.then(user => getOrders(user.id))
.then(orders => getDetails(orders[0].id))
.then(details => console.log(details));
This flattens callback hell into a readable chain.