Created
          May 11, 2022 03:14 
        
      - 
      
 - 
        
Save caominhdev/6c8aaeb46db2cd5e04abb4f0ae760243 to your computer and use it in GitHub Desktop.  
    inventoryList
  
        
  
    
      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
    
  
  
    
  | function inventoryList() { | |
| return { | |
| items: [], | |
| add: function (name) { | |
| if (this.items.includes(name)) { | |
| return | |
| } | |
| this.items.push(name) | |
| }, | |
| remove: function (name) { | |
| if (this.items.includes(name)) { | |
| let index = this.items.indexOf(name); | |
| if (index > -1) { | |
| this.items.splice(index, 1) | |
| } | |
| } | |
| }, | |
| getList: function () { | |
| return this.items; | |
| } | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment