Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript get all instances of a class

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.
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #instances #class
ADD COMMENT
Topic
Name
7+8 =