Join Leigh Lawhon for an in-depth discussion in this video Regular sort method, part of Web Portfolio Projects: Sortable Table and Arrays.
- [Instructor] Let's see how we can dig in to our JSON.…First notice that we're reassigning the data variable…down on line 39 with our results.…On line 130, let's go ahead and pass that data…to our regular sort function.…And on line 162, we'll do an arr.sort.…And as we saw previously,…this simple sort doesn't always work.…If we have anything more complicated…than an array with single-digit numbers,…we're going to have to pass it a function.…
So inside my sort,…I'll do a fat arrow function…and that gets the parameters of a and b.…A gives me the current row of data…while b gives me the next row of data.…We'll create a const x here…and that's going to be equal to a at the index of area.…Now normally I wouldn't hard code this,…but you'll see in just a moment we'll change this.…Let's check to see first if the value is null.…
We'll be sorting these values.…However, we need to check if a value is null…because we want to be able to push that down no matter what.…So we'll use a ternary.…So a at index of area,…if it's equal to null,…
- Sorting your table efficiently
- Filtering null values and sorting nodes
- Sorting algorithms, including merge sort and insertion sort
- Performance testing
- Creating your own algorithm
- Design components
- Adding icons
Skill Level Intermediate
Workflow Tools for Web Developerswith Christina Truong1h 13m Intermediate
What you should know1m 33s
1. Getting Started
2. Sorting Our Table Efficiently
3. Sorting Algorithms
4. Creating Our Own Algorithm
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.