I encountered a situation where I need to stop the execution of the next function call if the previous function has a return statement. However, I noticed that even though there is a return statement in the "b" function below, the next function call still executes.
function main(){
a()
b();
c();
}
function a(){
console.log("function a call!!");
}
function b(){
console.log("function b call!!");
return function(){return 0;}
}
function c(){
console.log("function c call!!");
}
main()
Output :
'function a call!!'
'function b call!!'
'function c call!!'
Expected output:
'function a call!!'
'function b call!!'
Could someone provide guidance on the correct approach to handle this?