Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Practice forEach in JavaScript!
You have completed Practice forEach in JavaScript!
Preview
Let's walkthrough the solution to the first code challenge.
This video doesn't have any notes.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
store the total in
the variable named total.
0:00
Before I show you how I solve this
code challenge, I'm going to copy and
0:01
paste the code for this challenge
into GitHub's Atom text editor.
0:05
Doing this will make
the code easier to read.
0:11
To solve this challenge, I started by
adding the call to the forEach method.
0:15
We wanna iterate over the numbers array,
so I'll type numbers.forEach.
0:19
Then I added the anonymous call back
function using error function syntax.
0:27
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up