Build a sortable HTML data table where clicking a column header sorts the rows by that column, alphabetically or numerically.
Create a table with several columns and rows of data. Clicking a column header should sort the rows based on that column's values, and clicking again should toggle the sort direction.
Implement the sorting logic in JavaScript, comparing values numerically when they are numbers and lexicographically when they are strings.
Add a visual indicator (arrow) on the active sort column.
Test that sorting works correctly for both numeric and text columns, and that toggling direction reverses the order.
Algorithm Flow
Best Answers
Solutions Coming Soon
Verified best solutions for this Challenge are still being analyzed and will be available soon.
Comments (0)
Join the Discussion
Share your thoughts, ask questions, or help others with this Challenge.
