- Assign object literal properties
var foo = { bar : 'hello'}; - Ternary
var cats = happy ? "yes" : "no"; - Label a statement
outer_loop: for(i=0; i<3; i++) - What else?
I'm poking through a sharepoint 2010 file and I keep running into this syntax
someFunction: ;
For instance, there is a file where the following function is declared near the top:
function ULSqvN() {
var o = new Object;
o.ULSTeamName = "SharePoint Portal Server";
o.ULSFileName = "SocialData.js";
return o;
}
and then later in the file we find the following
PageUrlNormalizer = function () {
ULSqvN: ; //<---------------- This guy here --------------------------
try {
this._url = _normalizedPageUrlForSocialItem
} catch (a) {
this._url = ""
}
};
What is this doing?
jsFiddle with full file. This same ULSqvN: ; occurs 47 times in the file.
edit: Added full code.
PS: Consensus seems to be that the sharepoint use of colon is "not actual javascript, possibly used as a marker for some external purpose". The browser sees it as a vestigial label and so causes no errors. Thanks for all the replies, I have left the actual uses at the top so that the question contains the appropriate answers. question about same code
undefinedafter the semicolon: jsfiddle.net/ThinkingStiff/3F7UY. The only other use I could think of is a tracing or debugging tool, or perhaps unit testing. Maybe the coder was using them as comments?!