So you have good answers to WHY this is so - they are labels - but if you would want to have them like assignments, you could only wrap them in an "object":
var myClass = {
thing1: 123123,
thing2: "asdfasdf",
thing3: {asdf:1234},
thing4: function () {
return 1
},
parent: function() {
for (var i=0; i<10; i++) {
var a = 0
child: while(a < 5) {
a++
console.log(a)
if (a > 2)
break
}
}
}
};
console.log(myClass.thing1);
console.log(myClass.thing2);
console.log(myClass.thing3['asdf']);
console.log(myClass.thing4());
myClass.parent();
You can play around here:
http://jsfiddle.net/td951gc7/2/