A colon in ECMAscript is there for three reasons
- separating object keys from its values
- inline conditional statements
- labeling
you discoverd the latter. What you are basically doing is creating a label called a, then b, then c and finally you are assigning a value to a global variable d. So after
a:b:c:d = "happy days";
console.log(a); // reference error
console.log(d); // "happy days";
Most common usage for this is within a switch statement where we do it like
switch( foo ) {
case 0: break;
case 1: break;
// etc
}
But you can also directly "target" a label with the continue statement. That comes very close to goto in many other languages and looks like
foobar:
for(var i = 0; i < 10; i++) {
for(var j = 0; j < 10; j++) {
if( j === 2 )
continue foobar;
}
}
a:b:c:d = "happy days";assigns'happy days'tod. not toa:b:c:d..a:b:c:d, typea:bbbb:cccccc:garble:dwindow["a:b:c:d"] = "happy days";