Hi everyone I have such a problem, I have 2 asynchronous functions. I want only after the first is completely over, to run the second. This is what I tried to do:
run2functions = async () => {
await firstFunc();
await secondFunc();
};
firstFunc = () => {
console.log("first one");
//Api code for information from any server
}
secondFunc = () => {
console.log("second one");
//Api code for information from any server
}
run2functions();
But it does not always work, sometimes the code of the second function runs before the code of the first function, I'm not sure why, I used await to force the second to be only after the first one ends.
I only want the first function to end now to activate the second function.