Skip to content

Latest commit

History

History
16 lines (9 loc) · 416 Bytes

File metadata and controls

16 lines (9 loc) · 416 Bytes

How to Use the Map Method


In JavaScript, the .map() method allows you to create a new array by returning the results of calling a function that you provide on every element in a given array.

constnumbers=[1,2,3,4,5]constsquared=numbers.map((num)=>num*num)console.log(squared)

link