JSFiddle - React, Tailwind, and code Playground
by Shuaib Khan
JavaScript
/* function People() {
People.allInstances = [];
People.allInstances.push(this);
} */
class People{
constructor(name){
this.name = name;
People.allInstances.push(this.name);
}
}
People.allInstances = [];
const carry = new People("Carry");
const peter = new People("Peter");
const john = new People("John");
const mark = new People("carry");
const kennedy = new People("Kennedy");
const eliza = new People("Eliza");
const markus = new People("Markus");
console.log(People.allInstances);