Created
          July 1, 2022 01:28 
        
      - 
      
 - 
        
Save szaranger/d718f67fcb3350b680e1a69e72ea9c7c to your computer and use it in GitHub Desktop.  
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 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