JavaScript obtenga todas las instancias de una clase

MyClass.allInstances = [];
MyClass.allInstances.push(this);
//However, you need some way to figure out when to remove instances from this array, or you'll leak memory.
Miapolis