01 September
The map function of a JavaScript array applies a certain method to all elements and creates an array. Example 1 The following method call will change all values to positive function f() { var a = Array(1,2,-3,4); var b = a.map(Math.abs); } Output: a=1,2,-3,4 b=1,2,3,4 Example 2 The following method call will…