Sortable Movies in JavaScript
Build a Sortable List
1
Store Data as an Array
Each movie is an object: { title, year, rating }.
2
Sort with a Comparator
arr.sort((a, b) => a.year - b.year) — number sort by year.
3
Render to the DOM
Map sorted array to <li> elements and inject into a <ul>.
4
Add Sort Buttons
Click handlers re-sort by different keys, then re-render.
Master Full Stack Development at Noble Desktop
Noble Desktop's Full-Stack Web Development Certificate covers HTML, CSS, JavaScript, and the modern web stack.
In this video, we're going to look at how to build a movie database display.