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 JavaScript Array Iteration Methods!

- 2x 2x
- 1.75x 1.75x
- 1.5x 1.5x
- 1.25x 1.25x
- 1.1x 1.1x
- 1x 1x
- 0.75x 0.75x
- 0.5x 0.5x
Use the reduce method to return a single value from an array of values.
Snippets from the Video
const prices = [6.75, 3.10, 4.00, 8.12]; // Total: 21.97
let total = 0;
prices.forEach(price => {
total += price;
});
console.log(total);
const names = ['Gary', 'Pasan', 'Gabe', 'Treasure', 'Gengis', 'Gladys', 'Tony'];
// Result: 4
MDN Resources
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up-
Seth Missiaen
Web Development Techdegree Graduate 21,652 Points1 Answer
-
Frank keane
8,074 Points1 Answer
-
Rick S
11,273 Points3 Answers
-
Daniel Cranney
11,609 PointsI got the right answer for numberOf503 challenge, but it feels like a cheat. How else could I do it?
1 Answer
-
Zachary Davidson
Full Stack JavaScript Techdegree Graduate 14,454 Points1 Answer
-
Dwayne Bynum
10,408 Points1 Answer
-
Peter Retvari
Full Stack JavaScript Techdegree Student 8,392 Points1 Answer
-
Akash Sharma
Full Stack JavaScript Techdegree Student 14,147 Points3 Answers
View all discussions for this video
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
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