Reputation: 139
I would like to ask what does mean this:
document:HideContent('content1');
I can't find any explanation why function HideContent defined as regular function is called with colon (":") instead of dot "." as usual. Does this have any special meaning? Or dos it have some features?
Upvotes: 0
Views: 90
Reputation: 522165
That syntax can only possibly be a label. It's creating the label document
and then executes one statement within it (HideContent()
). Since the label isn't used within any loop construct by the author, it's pointless.
I suspect the author of the code doesn't really know Javascript and wanted to do something like call HideContent
in the "global scope", but found document.HideContent
to not work and pounded on the code until it stopped throwing errors. That the result is rather nonsensical and doesn't actually do what they thought it does didn't occur to them. This will work exactly the same when you simply omit document:
.
(BTW, the "global scope" resolution would correctly be window.HideContent()
.)
Upvotes: 2