Reputation: 3134
I came across the following recently, which seems to be an object declaration, starting with just a semi-colon. It works fine.
;(function() { var ..... = this; })()
Are there any difference in declaring it this way or if there are alternatives?
Upvotes: 0
Views: 38
Reputation: 59292
There are a lot of concepts you've got wrong.
;
is used so that the code doesn't break when several scripts are minified into a single file.Upvotes: 2
Reputation: 1650
"functions in objects" are called methods.
var foo = {
x: function() {} // method
}
Upvotes: 0