1 00:00:00,080 --> 00:00:04,310 For the first challenge, we need to use the forEach method to add together 2 00:00:04,310 --> 00:00:07,100 all of the elements in the numbers array, and 3 00:00:07,100 --> 00:00:10,550 store the total in the variable named total. 4 00:00:10,550 --> 00:00:14,374 Before I show you how I solve this code challenge, I'm going to copy and 5 00:00:14,374 --> 00:00:18,036 paste the code for this challenge into GitHub's Atom text editor. 6 00:00:20,301 --> 00:00:24,000 Doing this will make the code easier to read. 7 00:00:24,000 --> 00:00:28,460 To solve this challenge, I started by adding the call to the forEach method. 8 00:00:28,460 --> 00:00:34,628 We wanna iterate over the numbers array, so I'll type numbers.forEach. 9 00:00:36,369 --> 00:00:41,570 Then I added the anonymous call back function using error function syntax. 10 00:00:41,570 --> 00:00:44,160 Since we're iterating over a list of numbers, 11 00:00:44,160 --> 00:00:48,970 I named the current value parameter, number, followed by a fat arrow. 12 00:00:50,750 --> 00:00:54,760 For the function body you could add a code block like I just did here. 13 00:00:56,200 --> 00:01:01,170 Or, you could just write the expression to add each number to the total variable. 14 00:01:01,170 --> 00:01:04,900 There are a couple of ways to add the number to the total variable. 15 00:01:04,900 --> 00:01:08,050 You could add the total variable to the number parameter and 16 00:01:08,050 --> 00:01:11,055 assign the result back to the total variable like this. 17 00:01:11,055 --> 00:01:16,910 Total equals total plus number. 18 00:01:16,910 --> 00:01:22,307 Or, you could use the addition assignment operator to make this code more concise. 19 00:01:24,164 --> 00:01:27,940 Total plus equals number. 20 00:01:29,530 --> 00:01:34,720 That's the approach that I ended up using and that completes this challenge. 21 00:01:34,720 --> 00:01:36,540 So how did you do? 22 00:01:36,540 --> 00:01:39,870 Don't worry if your solution didn't match mine exactly. 23 00:01:39,870 --> 00:01:43,920 There's definitely more than one way to correctly solve this challenge. 24 00:01:43,920 --> 00:01:45,620 See you after the next challenge.