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 Strings Comparing Strings

Chris Shaffer
Chris Shaffer
12,030 Points

This lesson is ridiculous

I'm sorry, but I've taken some JS courses previously and this lesson is so far off topic as to be off-putting to noobies.

I fact that a comparison function is given, but barely explained and then the compare() method is called checking the values of strings based on their ASCII value is just ridiculous.

I'm no JS expert, but I'd say this lesson is both unnecessarily confusing and irrelevant to learning JS.

3 Answers

James Barnett
James Barnett
39,199 Points

> irrelevant to learning JS

Building a list is a very popular first project. What if you wanted to make an a to z sort function, comparing strings is great for that.

Chris Shaffer
Chris Shaffer
12,030 Points

No no, I agree 100%. The fact that the lesson focuses on sorting by ASCII value is what I thought was ridiculous.

Normally the ASCII value isn't something that would have much importance in JS. Maybe in C or machine code, but not JS.

I just mean that there is unnecessary information that could easily confuse someone who hadn't, say (like myself) taken JS or EE courses previously.

James Barnett
James Barnett
39,199 Points

> The fact that the lesson focuses on sorting by ASCII value is what I thought was ridiculous.

Not sure I understand where you are going with this. Sorting strings is must be be done using ASCII. And doing sorting functions on the front-end makes sense.

It doesn't really belong on the backend because you aren't changing data in a database, and the time it takes to send data to a server and back reduces unnecessary latency into the sorting operation.

Chris Shaffer
Chris Shaffer
12,030 Points

I don't know but it's confusing as hell to suddenly throw in ASCII. I don't know JS well but I seemed to have learned a lot of it never having to deal with ASCII.