Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save szaranger/d718f67fcb3350b680e1a69e72ea9c7c to your computer and use it in GitHub Desktop.
Save szaranger/d718f67fcb3350b680e1a69e72ea9c7c to your computer and use it in GitHub Desktop.
class User {
isActive = false;
get getStatus(){
if(!this.#isActive){
throw new Error('User is not active');
}
return this.#isActive;
}
}
// Evaluate outside the class body
try {
const state = User.isActive;
User.isActive = state
} catch {
User.isActive = false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment