Search⌘ K
AI Features

Exercise: String Slicing

Explore how to apply the slice method on strings and arrays, and understand the use of sorting with localCompare in JavaScript. This lesson helps you practice sorting string rows while preserving headers, improving your skills in string manipulation and array handling techniques.

We'll cover the following...

Sort the rows given below based on their titles. Make sure you exclude the header row.

Hint: the slice method works in the same way on arrays as on strings.

Solution

First, we ...