I have just noticed that I can do the following in javascript…
a:b:c:d = "happy days";
a:b:c = function(text){alert(text);};
I cannot however do…
var a:b:c:d = "happy days";
// or
var myObj = {prop:a:b:c:d};
I was not expecting this syntax to work under any circumstances. Does anyone have any idea what is going on when I successfully use the ‘a:b=x’ notation?
Quoting the ECMAScript standard: “A Statement may be prefixed by a label. Labelled statements are only used in conjunction with labelled
breakandcontinuestatements.” A label consists of an identifier and a colon. Soa:b:c:d = "happy days";is just an assignment statementd = "happy days";prefixed by three labels, which have no effect as such.