I have a helper function that calls other functions. I want the called functions to finish before continuing on in the helper function.
currently they are both changing things at the same time.
helperDikjstras = async() => {
//do stuff
await this.colorVisited(visitedNodes); // I want this function to finish before continuing
await this.colorPath(path);
//EDIT: I've also tried:
this.colorVisited(visitedNodes).then(() => this.colorPath(path));
return;
}
colorVisited = async (visitedNodes) => {
//do stuff
return;
}
colorPath = async (path) => {
//do stuff
return;
}
returnstatements are implied in JavaScript - there is no need to addreturn;