I've seen this odd behavior right now that I could not define
function(){}
or
function(a){
console.log(a)
}
It throws an Uncaught SyntaxError
.
But test = function(){}
or (function(){})
did work.
The Safari dev tools have a better error report: It says
SyntaxError: Function statements must have a name.
Okay it makes no sense to define a function like that if you will never use it. But it's still odd. I guess I have already provided the answer in the question.