Answer to Question #171759 in HTML/JavaScript Web Application for manikanta

Question #171759

Array of Strings to UpperCase

Given an array

myArray of strings as an input, write a JS program to convert all the strings in myArray to uppercase.
Input

  • The input will be a single line containing an array myArray

Output

  • The output should be a single line containing an array of strings in uppercase


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' ]




1
Expert's answer
2021-03-15T12:14:50-0400
function arrayToUpperCase(arr) {
    return arr.map(item => item.toUpperCase())
}

const myArray = [ 'book', 'table', 'strawberries', 'lemons' ];

const res = arrayToUpperCase(myArray);

console.log(res);

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS