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 JavaScript Foundations Arrays Methods: Part 2

Alexandre Calice
Alexandre Calice
6,271 Points

Challenge JS - Methods part 2

Hi, Can someone help me out, provide a tip on the second task of this code challenge ? Team Treehouse: it would be great to provide some tips and/or implement a system to 'buy' tips (like in Code Avengers) so that student are not miserably stuck on a given challenge.thanks for feed back. Alex

2 Answers

Calvin Nix
Calvin Nix
43,828 Points

Hey Calice,

Inside of the sort method you want to add a function that returns the difference in lengths.

e.g.

saying2.sort(function(first, second){
   return first.length - second.length;
});

Additionally,

A lot of tips can be found by searching the forums for past issues that users have experienced in the same code challenge.

Ana Gledovic
Ana Gledovic
7,465 Points

Hey Calice and Calvin, definitely important and very useful skill in web development is to know how to find the solution for the problem easy. I had the same issue with this challenge and found this discussion for about 30 seconds. Thank you both.