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

Robbie Thomas
Robbie Thomas
31,093 Points

Challenge 2

var saying2 = ["The", "quick", "brown", "fox", "jumped", "over", "the", "lazy", "dog's", "back"]; saying1.reverse(); saying2.sort(function (a, b) { return.length b - a; });

Says I'm doing this wrong, but I'm unsure what I'm suppose to do here.

2 Answers

Ryno Botha
PLUS
Ryno Botha
Courses Plus Student 4,055 Points

^^ Close:

saying1.reverse(); saying2.sort(function (a, b) { return a.length - b.length;});
Ryno Botha
Ryno Botha
Courses Plus Student 4,055 Points
var saying1 = ["The", "quick", "brown", "fox", "jumps", "over", "the", "lazy", "dog"];

var saying2 = ["The", "quick", "brown", "fox", "jumped", "over", "the", "lazy", "dog's", "back"];
Robbie Thomas
Robbie Thomas
31,093 Points

Thanks a bunch for helping on both of my questions. I'm going to need to take the course over and over again to get the general idea of how JavaScript works.