Categories
HTML JavaScript

JavaScript: Sortable Table

In this exercise, you will make a user-sortable HTML table. The table’s contents–a list of Shakespeare plays, with titles, genres, and year of composition—-will be loaded dynamically via JS into the table.

We will do this without external libraries, just vanilla JavaScript.

First please download this file. It contains an array of objects. Each object has three keys: title, genre, and year. The user will be able to sort by any key, and to be able to reverse any sort.

const plays = [

  {
    title: `Antony and Cleopatra`,
    genre: `tragedy`,
    year: 1606
  },

  {
    title: `Coriolanus`,
    genre: `tragedy`,
    year: 1608
  },

etc. etc.