싱글톤 패턴을 사용해 Counter 클래스를 구현하세요.
싱글톤 패턴은 클래스의 인스턴스가 오직 하나만 존재하도록 보장하고, 전역적으로 접근할 수 있는 방법을 제공합니다.
Counter는 private 생성자를 가져야 합니다Counter.getInstance()는 항상 동일한 인스턴스를 반환해야 합니다increment(), decrement(), getCount() 메서드를 구현하세요const a = Counter.getInstance();
const b = Counter.getInstance();
a.increment();
console.log(b.getCount()); // 1 — 같은 인스턴스!
console.log(a === b); // true