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 trialfillipi rocha
335 Pointscant complete my forEach loop
cannot complete my foreach loop and log it into the times 5 let
const numbers = [1,2,3,4,5,6,7,8,9,10];
let times5 = [];
// times5 should be: [5,10,15,20,25,30,35,40,45,50]
// Write your code below
numbers.forEach(function(number) {
console.log(number);
});
2 Answers
Steven Parker
231,269 PointsYou've got the function set up correctly, now in the body of the function you just need to multiply the current number by 5 and then add that on to the "times5" array. A couple extra hints:
- the "push" method could be handy
- you won't need to log anything to the console
Patrick Marshall
13,508 PointsHi FIllipi, The challenge Is asking you to multiply each number in the numbers array by 5 and add it to the empty array times5. While your forEach structure is good you're missing this part of the challenge.
Hope this helps.