Curly brackets for function blocks on one line
I am getting back to writing javascript after not using the language for several years.
It used to be thought that using built-in functions such as
doSomething(function() console.log('its done'));
will work in all important browsers. Now it seems that chrome is having problems with this:
Uncaught SyntaxError: Unexpected identifier
But not with this:
doSomething(function() {console.log('its done')});
What is the reason for the severity of chrome? Where can I read about this? Does it make sense and finally how can I disable it? I prefer the no-curly brace option for simple liners.
+3
source to share
No one has answered this question yet
See similar questions:
or similar: