Skip to content

Commit eb74947

Browse files
committed
solved challenge 1 and 2 on array-methods.js
1 parent e0f9ed7 commit eb74947

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

assignments/array-methods.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,12 @@ const runners = [{"id":1,"first_name":"Charmain","last_name":"Seiler","email":"c
5656
// ==== Challenge 1: Use .forEach() ====
5757
// 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(element => fullName.push(`${element.first_name} ${element.last_name}`));
5960
console.log(fullName);
6061

6162
// ==== Challenge 2: Use .map() ====
6263
// 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
63-
let allCaps = [];
64+
let allCaps = runners.map(element => element.first_name.toUpperCase());
6465
console.log(allCaps);
6566

6667
// ==== Challenge 3: Use .filter() ====

0 commit comments

Comments
 (0)