...

/

Solution: Going Loopy Over Arrays

Solution: Going Loopy Over Arrays

Review solutions to the tasks from the going loopy over arrays challenge.

We'll cover the following...

Solution 1

Here is a possible solution for the capitals function that uses the map to return a new array of the same words written in uppercase.

Press + to interact
const arr = ["red", "car", "arrow", "burger", "javascript"];
function capitals(arr) {
return arr.map(word => word.toUpperCase());
}
console.log(capitals(arr));

Explanation

  • Line 1: Declares a constant variable arr and assign it an array containing five strings. ...