Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change singleton pattern counter class #29

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bpetermann
Copy link

@bpetermann bpetermann commented Aug 19, 2023

Hi,
the counter class gave me the following error messages:

  • counter is not defined
  • After initialization (this.counter = 0) "counter is read-only"

Removing Object.freeze and returning the instance in the constructor should resolve this issue.

Otherwise, as in the Objects example, counter can also be initiated outside the class: let counter = 0;
After that, however, the "this" keyword would have to be removed from the methods.

Thanks!

@vercel
Copy link

vercel bot commented Aug 19, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
fm-workshop-2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 19, 2023 0:55am

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant