getInstance method

PHOTO EMBED

Mon Aug 15 2022 10:54:42 GMT+0000 (Coordinated Universal Time)

Saved by @ale_figure8

class Singleton {

  static getinstance(){
    return Singleton.instance;
  }

  constructor(){

    this.random = Math.random();

    if(Singleton.instance){
      return Singleton.instance;
    }
    
    Singleton.instance = this;
  }
content_copyCOPY