I have the hypothetical situation:
function fTeste2(valor) {
setTimeout(function() {
alert("Hello");
}, 3000);
return valor + 5;
}
function fTeste1(valor) {
return fTeste2(valor);
}
alert(fTeste1(10));
Notice that function 2 sends the sum without completing the whole internal process, I know that if I put the sum inside the settimeout it will wait and give me the result, but function 2 exemplifies a function with several operations, this in another language would expect the termination of function 2, already in javascript this does not occur, how to solve?