Created
April 2, 2021 19:01
-
-
Save jordanhudgens/e7920f9ea1704279898ebb4c0dc3992f to your computer and use it in GitHub Desktop.
This file contains 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 familyNames = ["Jordan", "Tiffany", "Kristine"]; | |
// let capitalizedNames: string[] = []; | |
// for (var i = 0; i < familyNames.length; i++) { | |
// capitalizedNames.push(familyNames[i].toUpperCase()) | |
// } | |
// console.log(capitalizedNames) | |
const capitalizedNames = familyNames.map((name: string) => (name.toUpperCase())) | |
const capitalizedNames2 = familyNames.map((name: string) => { | |
if (name === "Tiffany") { | |
return name.toUpperCase() | |
} else { | |
return name.toLowerCase() | |
} | |
}) | |
console.log(capitalizedNames2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment