Array of Strings to UpperCase
Given an array
Sample Input 1
[ 'book', 'table', 'strawberries', 'lemons' ]
Sample Output 1
[ 'BOOK', 'TABLE', 'STRAWBERRIES', 'LEMONS' ]
Sample Input 2
[ 'my best friend', 'florida', 'winter' ]
Sample Output 2
[ 'MY BEST FRIEND', 'FLORIDA', 'WINTER' ]
function arrayToUpperCase(arr) {
return arr.map(item => item.toUpperCase())
}
const myArray = [ 'book', 'table', 'strawberries', 'lemons' ];
const res = arrayToUpperCase(myArray);
console.log(res);
Comments
Leave a comment