js break out of a function

JavaScript
By using 'return;':

function myfunction(){
   if(a == 'stop') 
      return;  //returns Void, ending function
}

Does not work when using a Conditional operator:

let result =  1 == 2   ?  "YES" : return;  //<--- throws error
Source

Also in JavaScript: