const originalArray = [ 'bmw', 'audi', 'mercedez', 'jaguar' ]; const upperCaseArray = originalArray.map(item => item.toUpperCase()); console.log(upperCaseArray);
[ 'BMW', 'AUDI', 'MERCEDEZ', 'JAGUAR' ]
In this code, we have an array called originalArray that contains strings in lowercase.
In the next step, we used the “map()” method to iterate through each array element and applied the “toUpperCase()” method to convert each string to uppercase. The result is a new array called uppercaseArray containing the uppercase versions of the original strings.
We used an arrow function to simplify the callback function passed to the “map()” method.