Last active
          December 7, 2024 20:28 
        
      - 
      
- 
        Save bethropolis/02e3471b6446f1a434d5dfe88814faae to your computer and use it in GitHub Desktop. 
    js arrays example
  
        
  
    
      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 arr = [1,2,3, 4,5,6,7,8] | |
| let fruits = ["Apple", "Orange", "Pear"]; | |
| // 0 1 2 | |
| // loop | |
| let doubled_result = arr.map(function(item){ | |
| return item * 2; | |
| }) | |
| let fruits_object = fruits.map((fruit, index)=>{ | |
| return { | |
| no: index + 1, | |
| name: fruit, | |
| } | |
| }) | |
| console.log(doubled_result) | |
| console.log(fruits_object) | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment