ES6 Classes & Constructors
What creational design pattern is implemented by the Logger class?
class Logger {
static instance;
constructor() {
if (Logger.instance) {
return Logger.instance;
}
this.logs = [];
Logger.instance = this;
}
log(message) {
this.logs.push(message);
console.log(message);
}
}