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 trialArthur Kakulidis
2,657 PointsCan someone please tell me what I'm doing wrong here.
I don't know what I'm doing wrong, please help.
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(times5 => alert(times5 *5));
2 Answers
hombah
Python Web Development Techdegree Student 16,241 Pointsconst numbers = [1,2,3,4,5,6,7,8,9,10];
let times5 = [];
numbers.forEach((time) => {
const newTime = time * 5;
times5.push(newTime);
return times5;
});
Arthur Kakulidis
2,657 PointsThank you! what you said worked.
hombah
Python Web Development Techdegree Student 16,241 Pointshombah
Python Web Development Techdegree Student 16,241 PointsI think forEach may also return a new array, so you might be able to save the output directly into time5 - it didn't seem to work for me in the workspace though