JSFiddle - React, Tailwind, and code Playground
JavaScript
(function() {
var Obj = function(val){
this.field = val;
Obj.instances.push(this);
};
Obj.instances = [];
a = new Obj(1);
b = new Obj(2);
c = new Obj(3);
console.log( Obj.instances); // a, b и c
})();