Created
          May 23, 2024 17:31 
        
      - 
      
- 
        Save victorferreira/a5e404b1dad1d1c204dcb26bfc3678e1 to your computer and use it in GitHub Desktop. 
    JS: reload module reference
  
        
  
    
      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
    
  
  
    
  | let storage = require("./storage"); | |
| storage.add("hello"); | |
| console.log(storage.size()); // 1 | |
| storage.add("hello1"); | |
| console.log(storage.size()); // 2 | |
| storage = undefined; | |
| delete require.cache[require.resolve("./storage")]; | |
| storage = require("./storage"); | |
| console.log(storage.size()); // 0 | 
  
    
      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
    
  
  
    
  | const arr = []; | |
| function add(value) { | |
| arr.push(value); | |
| } | |
| function size() { | |
| return arr.length; | |
| } | |
| exports.add = add; | |
| exports.size = size; | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment