Codecademy Practice

Address Book - Part 1

Challenge: Your company wants to be original and has decided that another address book is exactly the product that humanity needs. The product manager and the web designer have agreed on the look and feel as well as the branding. They have now given you the mockup and have asked you to implement the business logic behind it.

We are going to build an address book that will allow us to delete contacts, search contacts, sort contacts, etc. In the first part of this challenge, we are going to add the logic to delete a contact, since it’s the simpler action.

Things you’ll practice: Iterators, working with tables.

Example:

(contacts table is displayed)
Delete contact from database:
Orson Meadows
(Orson Meadows is deleted)
Video showing how deleting contacts works.

Step by step instructions:

HTML

An address book is proper tabular data, so we are going to use a table element to display it. Review HTML tables first.

CSS

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/6.0.0/normalize.min.css">

When you start a new project, you can check with the library website what is the last version available, and update your link if there is an update.

JS

let table = document.getElementById('table-id');

table.rows.forEach(...);
// throws an error :(

Array.from(table.rows).forEach( ... );
// works! :)

GIT

Work in a new project, in a separate branch to master. When the branch is ready create a pull request and ping me to review.

DEBUGGING

Use console.log() as usual.