Last active
          April 2, 2019 07:02 
        
      - 
      
- 
        Save martinhj/da35632a9de5b4cffb13e86bb17f60e1 to your computer and use it in GitHub Desktop. 
    Create and fill array of given size
  
        
  
    
      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
    
  
  
    
  | // create and fill array of given size | |
| const arrayWithNumbers = Array(4).fill(null).map((u, i) => i) [0, 1, 2, 3] | |
| // or | |
| const newArrayWithNumbers = [...Array(4)].map((u, i) => i) | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment