Skip to content

Commit 1e6e073

Browse files
committed
chore: Use map array method to convert first names to uppercase and return new array
1 parent eefc2e6 commit 1e6e073

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎assignments/array-methods.js‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,11 @@ console.log(fullName);
6565
// ==== Challenge 2: Use .map() ====
6666
// The event director needs to have all the runner's first names converted to uppercase because the director BECAME DRUNK WITH POWER. Convert each first name into all caps and log the result
6767
let allCaps = [];
68-
console.log(allCaps);
68+
fullName.map(runnerName => {
69+
let uppercaseFirstName = runnerName.split(' ')[0].toUpperCase();
70+
allCaps.push(`${uppercaseFirstName} ${runnerName.split(' ')[1]}`)
71+
})
72+
console.log(allCaps);
6973

7074
// ==== Challenge 3: Use .filter() ====
7175
// The large shirts won't be available for the event due to an ordering issue. Get a list of runners with large sized shirts so they can choose a different size. Return an array named largeShirts that contains information about the runners that have a shirt size of L and log the result

0 commit comments

Comments
 (0)