Articles → JAVASCRIPT → Array Map Function In Javascript

Array Map Function In Javascript






Purpose





Example


<html><head></head><body><script>
         var arr = [12, 15, 21, 23];
         
         console.log(arr.map(arr => arr));
         
         //  Multiply each value of an array by 2
         console.log(arr.map(arr => arr* 2));
         
         
      </script></body></html>



Output


Picture showing the output of map function in JavaScript



Posted By  -  Karan Gupta
 
Posted On  -  Thursday, August 26, 2021

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250