Convert an Array of Strings to Uppercase
Write a function named toUpperCase
that takes one parameter: arr
, which is an array of strings. The function should return a new array with all the strings in arr
converted to uppercase.
Example 1
Input: toUpperCase(["hello", "world"]);
Output: ["HELLO", "WORLD"]
Example 2
Input: toUpperCase(["JavaScript", "is", "fun"]);
Output: ["JAVASCRIPT", "IS", "FUN"]
Example 3
Input: toUpperCase(["openAI", "gpt-4"]);
Output: ["OPENAI", "GPT-4"]
Are you stuck on this problem?
Get detailed, step-by-step solution and improve your JavaScript skills.
- Detailed Explanation: Each solution comes with a comprehensive explanation, helping you understand the logic and concepts thoroughly.
- Learn to Write Better Code: Even if you have written the code, discover ways to improve it and adopt best practices.
- Save Time: Don’t waste hours struggling—get the solution and learn efficiently.
- Lifetime Access: Get access to lifetime solutions for all problems available
" I struggled with this problem for hours, but the solution provided here was clear and easy to follow. It helped me understand where I went wrong and improved my coding skills significantly." - Jane D.
If you're not satisfied, I offer a 7-day money-back guarantee.