Why do I get the following error...
Uncaught TypeError: object is not a function
...at the following line, of a certain JS script?
(function($){
And why do I get that error only when JS are concatenated? (I'm using Gulp)
And why does it work if I add ;
before that line, like that:
;(function($){
?
update
The preceding line - that is, the object which is not a function, according to the runtime error - on the concatened script was a }
, as in:
storage = {
//...
}
I'm used to always put semicolon, but not after curly braces.
Turns out the curly braces could delimit the end of a statement, like in this case, and then it's recommended to use the semicolon to avoid this error. Here's a good explanation.