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 trialfc3
Python Web Development Techdegree Student 9,205 PointsExtra parenthesis at the end of the video.
Just wanted to point out that there is an extra parenthesis in the code at the end of the video.
4 Answers
Alexander Davison
65,469 Pointsdays.forEach(day => dayAbbreviations.push(day.slice(0, 2)));
Where's the extra parenthesis?
kevinardo
Treehouse Project ReviewerI often get confused and think that there is an extra parenthesis when there are 3 in a row, even if it is correct. Looks a bit funky, but that's the way we roll :)
Michel Ribbens
18,417 Pointsagree, I personally like it more to write the code like this instead of putting everything on one line. also, I use more often a bit of extra space between the first and last parenthesis. makes it a bit more readable in my opinion
this was my solution:
days.forEach( day => {
dayAbbreviations.push( day.substring(0, 2) );
});
console.log(dayAbbreviations);
oh btw for those that are using VS Code as their editor: install the plugin Bracket Pair Colorizer. great plugin that adds extra colors to figures like [], {}, () etc. makes it a lot easier to check and debug your code!
Jay Thomas
Full Stack JavaScript Techdegree Student 6,734 PointsI didn't remember about substring or slice. So I used:
days.forEach(day => { dayAbbreviations.push( day.charAt(0) + day.charAt(1)) });
fc3
Python Web Development Techdegree Student 9,205 Pointsfc3
Python Web Development Techdegree Student 9,205 PointsThere isn't one actually, I was overlooking one of the opening parenthesis. Thanks.