0
How do I create sub-calls in Javascript functions?
Below follows example of usage, my doubt is how to create a Function of this type. Depending on what happens within the "Travel" routine, a call to "Arrival" and/or "Problem"
this.Viajar('são paulo').Chegada(() => {
console.log('chegou com sucesso')
}).Problema(() => {
console.log('pneu furou')
});
an if does not solve? I did not understand your question right
– Danielle Arruda torres
You can use Promise. https://codepen.io/valdeir2000/pen/WJJZMQ?editors=1011
– Valdeir Psr