Skip to content

Commit 550218e

Browse files
committed
Complete Challenge 1
1 parent efa2a08 commit 550218e

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

assignments/array-methods.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,17 @@ const runners = [{"id":1,"first_name":"Charmain","last_name":"Seiler","email":"c
5454
{"id":50,"first_name":"Shell","last_name":"Baine","email":"[email protected]","shirt_size":"M","company_name":"Gabtype","donation":171}];
5555

5656
// ==== Challenge 1: Use .forEach() ====
57-
// The event director needs both the first and last names of each runner for their running bibs. Combine both the first and last names into a new array called fullName.
57+
// The event director needs both the first and last names of each runner for their running bibs. Combine both the first and last names into a new array called fullName.
5858
let fullName = [];
59+
runners.forEach(function (runner) {
60+
fullName.push(`${runner.first_name} ${runner.last_name}`)
61+
})
5962
console.log(fullName);
6063

6164
// ==== Challenge 2: Use .map() ====
6265
// 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
6366
let allCaps = [];
64-
console.log(allCaps);
67+
console.log(allCaps);
6568

6669
// ==== Challenge 3: Use .filter() ====
6770
// 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
@@ -80,4 +83,4 @@ console.log(ticketPriceTotal);
8083

8184
// Problem 2
8285

83-
// Problem 3
86+
// Problem 3

0 commit comments

Comments
 (0)