Home / Javascript Tips Generated By ChatGPT / Understanding the Use of Array.map() in Javascript Apply a function on every element of an array and return a new array. Source Code let numbers = [1, 2, 3, 4]; let squares = numbers.map(function(num) { return num * num; }); console.log(squares); // [1, 4, 9, 16]