I am trying to determine the rules for generating class names in javascript. I pasted this script into Chrome dev tools console:
var obj = {
Constr : function() { }
};
var obj2 = obj;
console.log(new obj.Constr());
console.log(new obj2.Constr());
obj2.Constr2 = function() { };
console.log(new obj.Constr2());
console.log(new obj2.Constr2());
And here are the results in the console:
obj.Constr
obj.Constr
obj2.Constr2
obj2.Constr2
It seems that the name of the class is determined by the variable that the constructor function was originally assigned to. I am looking for the precise rules that CDT uses to generate this name. Also, is this the same name that the Google Closure Compiler recognizes?
I have tried to see if I can reproduce similar behavior in Firebug, but I can't seem to get class names to print out in the console. As a secondary question, does anyone know how to see this in firebug?