1You can just use return
2
3Example:
4function myFunction() {
5 console.log("I QUIT!")
6 return;
7}
1By using 'return;':
2
3function myfunction(){
4 if(a == 'stop')
5 return; //returns Void, ending function
6}
7
8Does not work when using a Conditional operator:
9
10let result = 1 == 2 ? "YES" : return; //<--- throws error