JSFiddle - React, Tailwind, and code Playground
JavaScript
class User {
constructor(name, type = 'simpleUser') {
this.name = name;
this.type = type;
this.id = User.prototype._quantity;
User.prototype._quantity++;
}
}
User.prototype._quantity = 0;
let hello1 = new User('Zed');
let hello2 = new User('Alpha');
let hello3 = new User('Omega');
alert(hello1.id);
alert(hello2.id);
alert(hello3.id);