Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Practice forEach in JavaScript Practice forEach forEach Practice - 1

Deprecation and warning in the MDN

The MDN Warns to never use a foreach loop with an array only objects. Does anyone know more about this?

app.js
const numbers = [1, 2, 3, 4, 5];
let total = 0;

// Write loop here:

2 Answers

Paolo Scamardella
Paolo Scamardella
24,828 Points

I believe you are confused with for-each-in vs forEach. It is perfectly fine to use forEach, and the task is asking to use forEach. for-each-in is the one that is or will be deprecated.

Here is the link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/For-each-in_loops_are_deprecated

Very Cool. Cleared it right up. Thanks for jumping in there and helping. Cheers!!!