After 20+ years of programming I learnt something new today, while messing about with the php_spidermonkey extension.
If you place a carriage return after a 'return' statement in Javascript, and put some code on the line underneath, the function returns 'undefined', as if the statement was simply:
Here's an example of a function that returns 'undefined':
If you place a carriage return after a 'return' statement in Javascript, and put some code on the line underneath, the function returns 'undefined', as if the statement was simply:
return;
Here's an example of a function that returns 'undefined':
function whatelse()
{
var ok =false;
return// function ends here
ok ?'OK (true)':'OK (false)'; // this line is never executed!
}