Sort Arrays with JavaScript Methods

Offered By
Coursera Project Network
In this Guided Project, you will:

Recognize the variety of ways in which an array's elements can be ordered.

Sort the elements in an array into a specific order.

Use the JavaScript sort() method to sort elements in an array.

Clock2 hours
IntermediateIntermediate
CloudNo download needed
VideoSplit-screen video
Comment DotsEnglish
LaptopDesktop only

By the end of this project, you will have gained practical experience in sorting the elements in an array using a JavaScript method. You will learn to reorder the elements in an array using specific techniques based on whether the element values are numbers, letters, mixed-case letters, or objects. Note: This course works best for learners who are based in the North America region. We’re currently working on providing the same experience in other regions.

Skills you will develop

Sorting ArraysJS Sort() methodJavascript MethodsObject arraysjavascript syntax

Learn step-by-step

In a video that plays in a split-screen with your work area, your instructor will walk you through these steps:

  1. Use the JavaScript sort() and reverse() methods to sort elements in an array in alphabetic and reverse alphabetic order.

  2. Use the JavaScript sort() method with toLowerCase() and localeCompare() methods to correctly sort mixed-case elements in an array.

  3. Alter an array sort to use simple math with the JavaScript sort() method to compare the numeric value of elements as they are sorted.

  4. Reorder the elements in an array randomly using the JavaScript sort() method with arguments that include the random() method.

  5. Include a property name in the JavaScript sort() method function to order the elements in an object array by property value.

How Guided Projects work

Your workspace is a cloud desktop right in your browser, no download required

In a split-screen video, your instructor guides you step-by-step

Frequently asked questions

Frequently Asked Questions

More questions? Visit the Learner Help Center.