function blue(){Since return keywords used in a function body return a value to the place the function is invoked, we'll invoke the function from an alert statement within an a tag, causing the value returned by blue() to be alerted.
var myColor = "blue"
return myColor
}
<a href="javascript:alert( blue() )">call function</a>I'll show you many more practical uses of the return keyword later within this tutorial.
<a href="http://jennifermadden.com" onclick="return false">Try to Leave</a>Since return keywords used within event handlers return a true or false value (boolean value) to the browser, they are generally used to interupt a natural browser behavior. In this example, the return false statement is interupting the browser's natural behavior of opening the URL contained in the href attribute's quotes. There is no convention as to when to use true or false - the various behaviors respond to true and false differently.