We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
class Count { } const instance = new Count() console.log(instance.add())//1 console.log(instance.add())//2 console.log(instance.add())//3 console.log(instance.reset())//1 console.log(instance.add())//1
The text was updated successfully, but these errors were encountered:
class Count { constructor(value = 0){ this.value = value; } add(){ this.value++; return this.value; } reset(){ this.value = 1; return this.value; } } const instance = new Count() console.log(instance.add())//1 console.log(instance.add())//2 console.log(instance.add())//3 console.log(instance.reset())//1 console.log(instance.add())//2
最后一个应该是2吧
Sorry, something went wrong.
class Count { constructor() { this.count = 0; } add() { return ++this.count; } reset() { this.count = 0; return this.add(); } } const instance = new Count(); console.log(instance.add()); // 输出 1 console.log(instance.add()); // 输出 2 console.log(instance.add()); // 输出 3 console.log(instance.reset()); // 输出 1 console.log(instance.add()); // 输出 2
No branches or pull requests
The text was updated successfully, but these errors were encountered: