JSFiddle - React, Tailwind, and code Playground

by Abdul Ahmad

JavaScript

class PlayerModel {
	constructor({ player = {} } = {}) {
  	this._player = player;
  }
  
  get abilities() {
  	return this.player.abilities;
  }
  
  get mainAbility() {
  	return this.abilities?.[0];
  }
  
  get expiredSub() {
  	return this.mainAbility?.someField;
  }
}

const player = new PlayerModel();

console.log('*** player.expiredSub', player.expiredSub);