In the last exercise, the tests checked your loan search for you. Now you’ll use the same skills on data that’s entirely yours, in a file you own and run. This is a short experiment of about fifteen minutes, not a project. It also gives you a feel for working with records locally before the final project, where you’ll write a whole program this way.
Write a Few Records of Your Own
Pick something you’d like to keep a small list of, such as films for a movie night, snacks, plants, books, or songs. Each record needs an id and two or three more fields with numbers or strings. Give every record the same field names, because each field becomes a column you can ask about.
Here’s one example. Create scratch/films.js, type in your own list, and inspect it with console.table():
scratch/films.js
const films = [
{ id: 1, title: "Paddington", minutes: 95 },
{ id: 2, title: "Spirited Away", minutes: 125 },
{ id: 3, title: "Toy Story", minutes: 81 },
{ id: 4, title: "The Princess Bride", minutes: 98 },
];
console.table(films);