I have a method that I want to finish before any code after it can be ran but am lost in understand external links when is comes to this.
In one method I have the following code
var x = someMethod("1","2","3"); // Finish before anything below can be ran
The method itself is simple
function someMethod(x,y,z){
if(1){
return "sdfh"
} else if(2){
return "asdf"
} else {
return "ljkk"
}
}
How can I retrieve x before continue the code below it. Ive seen examples of nested functions, await, async but am lost
someMethodis synchronous so your code is correct. But ifsomeMethodwas asynchronous hits signature would beasync function someMethod(x,y,z)and the call to it bevar x = await someMethod("1","2","3");