"use strict"; console.log("App"); let addForm = document.getElementById("addFormElement"); addForm.addEventListener("submit", addBook); let bookTable = document.getElementById("bookTableBody"); let lastBookId = 0; function genBookId() { return lastBookId++; } let books = {}; function addBook(event){ event.preventDefault(); console.log("Add Book", event.target.bookTitle.value); let bookId = genBookId(); let book = { title: event.target.bookTitle.value, genre: event.target.bookGenre.value, desc: event.target.bookDesc.value } books[bookId] = book; let row = ` ${bookId + 1} ${book.title} ${book.genre} ${book.desc} ` bookTable.innerHTML = bookTable.innerHTML + row; } function deleteBook(bookId) { console.log("Delete Book", bookId); let rowElement = document.getElementById("bookRow"+bookId); bookTable.removeChild(rowElement); delete books[bookId]; } function editBook(bookId) { console.log("Edit book"); let rowElement = document.getElementById("bookRow"+bookId); }