So there are dozens of questions with this title, however, all answers I could find seem to mention some hacks working in some specific cases but not being helpful in others. Many are concerned with jQuery or Ajax, yet the problem is pure JavaScript arising at very basic level:
function f() {
false || (return true);
}
This function declaration (without execution) throws
Uncaught SyntaxError: Unexpected token return
in Chrome and
SyntaxError: Return statements are only valid inside functions
in Safari. However this function doesn't:
function f() {
false || (a=true);
return true;
}
Anybody can explain this strange behaviour?