Created
December 10, 2021 15:29
-
-
Save danielchikaka/456fc0bc7d8dac1ddc4d06257fd51f1d to your computer and use it in GitHub Desktop.
Function to capitalize string array
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const changeToUpperCase = arr => { | |
const newArr = [] | |
for (const element of arr) { | |
newArr.push(element.toUpperCase()) | |
} | |
return newArr | |
} | |
const countries = ['Finland', 'Sweden', 'Norway', 'Denmark', 'Iceland'] | |
console.log(changeToUpperCase(countries)) | |
// ["FINLAND", "SWEDEN", "NORWAY", "DENMARK", "ICELAND"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment