To recap :
There are 2 main methods to do it :
1. Using the modern Javascript ES6 version with arrow function and map() iterator :
// the test array
const items = ['item1', 'item2', 'item3', 'item4', 'item5', 'item6'];
// declare the function with arrow function using the map iterator and the
// toUpperCase() buildin method
const countItems = arr => arr.map(item => item.toUpperCase());
2. Using the old good function style with a simple for loop, the toUpperCase() buildin method and the push() method
// the test array
const items = ['item1', 'item2', 'item3', 'item4', 'item5', 'item6'];
// the old way
function countItems(arr) {
newarray = [];
for (let i = 0; i < arr.length; i++) {
newarray.push(arr[i].toUpperCase());
}
return newarray;
};
3. call the function with any of the above snippets
console.log(countItems(items));
// Should print
[ 'ITEM1', 'ITEM2', 'ITEM3', 'ITEM4', 'ITEM5', 'ITEM6' ]
hope that this answer adds a small stone to whatever you want to build