CodeYourFuture / syllabus-archive

[ARCHIVED] Please use https://github.com/CodeYourFuture/syllabus
https://codeyourfuture.github.io/syllabus-master
74 stars 116 forks source link

Update sort method explanation and examples #464

Closed EmilePW closed 4 years ago

EmilePW commented 4 years ago

What does this change?

Module: JavaScript 1 Week(s): 3

Description

The previous explanation of the sort method wasn't correct as it doesn't sort alphabetically or numerically but instead according to the Unicode table. I think this could lead to some confusion if students later attempt to sort arrays containing capital and lowercase letters or numbers greater than 9. I've amended the original example (which works, but only in the narrow case provided) and also added a new one showing how you can pass a function to the sort method to change its sorting behaviour.

The sort method is somewhat counter intuitive and I'm slightly worried that by explaining it in full it might now be too heavy at this stage of the course? I say this especially as some of the feedback from JS week 2 was that a lot of students were confused about functions and parameters. Would love to get some other thoughts on this and on whether the examples/explanations I've used myself could be improved.

Rendered version

Who needs to know about this?

@ChrisOwen101

(Actually I'm unsure who I should be tagging here)