JavaScript for WordPress Forums Vanilla JavaScript Issue with array sorting example

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #4938
    Mike Little

    (Posting here for completeness, I already tweeted this)
    I spotted an error in your video on Arrays.

    To reverse sort, you need to swap the two parameters passed to the callback function and perform the same subtraction operation.

    See example here,console


    Zac Gordon

    Thanks so much Mike!

    I just posted an update to the official Code Examples and made a note on the video page.

    Good catch, thank you!

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.