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 Challenge 1 Solution

For the first challenge I used numbers instead of number and it still worked, whats the difference?

I used numbers.forEach(numbers => {total += numbers}); it was still accepted as correct but is this a bad habit to have or does it even matter?

1 Answer

Steven Parker
Steven Parker
229,921 Points

The word you changed is a function parameter, which only serves as a placeholder for information that will be supplied later when the function is invoked (a.k.a. "called").

Technically, it makes no difference what word you use as a parameter name (you could call it "fred" if you like), but it is considered "good practice" to use a word which conveys an idea of what the parameter is used for.