Given is the following code:
function two() {
return "success";
}
function one() {
two();
return "fail";
}
If you test the code by calling function one(), you will always get “fail”.
The question is, how can I return “success” in function one() by only calling function two()?
Is that even possible?
Regards
You can’t make a function return from the function that called it in Javascript (or many other languages, afaik).
You need logic in one() to do it. E.g.: