+ 2
Stop code execution?
I do not want to learn bad habits so therefore this questionđ Is the code below valid and correctly formatted to stop code execution? Or is it a bypass in some way to prevent code execution? (Are there more options to stop code execution?) var num = 0; function exec1() { if (num == 1) { exec2(); } else { // stop code execution if not equal console.log("STOP exec!") return; } // continue code execution if equal function exec2() { console.log("continue code exec"); } } exec1(); Additional: https://code.sololearn.com/WFViH595HcLe/?ref=app
1 Answer
+ 5
â yes whenever "return;" bring no results and stop further code execution and this is on if else so there are no other places where Code have to work on;