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

Private fields and private methods support #1718

Closed
lobau opened this issue Oct 29, 2021 · 3 comments
Closed

Private fields and private methods support #1718

lobau opened this issue Oct 29, 2021 · 3 comments

Comments

@lobau
Copy link

lobau commented Oct 29, 2021

If you write this valid ES6 code in JSFiddle, you get tons of errors

class Mosaic {
  #count;
  #view;
  constructor(div) {
    this.#view = document.getElementById(div)
  }
  set videoCount(count) {
    this.#count = count;
    this.#update();
  }
  get videoCount() {
    return this.#count;
  }
  #update() {
  	const result = `<h1>${this.#count}</h1>`;
  	this.#view.innerHTML = result;
  	console.log(this.videoCount);
  }
}

const mosaic = new Mosaic('container')
mosaic.videoCount = 2;

image

That's because JSFiddle does't understand the # used for private fields and private methods.
tc39/proposal-private-fields#14

@stale
Copy link

stale bot commented Feb 10, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale-archived label Feb 10, 2022
@stale stale bot closed this as completed Feb 17, 2022
@d-002
Copy link

d-002 commented Mar 30, 2022

The error stills occurs. Please reopen this issue

@zaxinothdigital
Copy link

I have this same problem. Please reopen this issue

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

No branches or pull requests

3 participants