Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

use map to loop through an array

let squares = [1,2,3,4].map(function (val) {  
    return val * val;  
}); 
// squares will be equal to [1, 4, 9, 16] 
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #map #loop #array
ADD COMMENT
Topic
Name
4+5 =