How do I create sub-calls in Javascript functions?
Below is an example of use, my question is how to create such a function. Depending on what happens inside the "Travel" routine, the call is called "Arrival" and / or "Problem"
this.Viajar('são paulo').Chegada(() => {
console.log('chegou com sucesso')
}).Problema(() => {
console.log('pneu furou')
});