Skip to content
This repository was archived by the owner on Oct 26, 2020. It is now read-only.

it's done #986

Open
wants to merge 1 commit into
base: manchester3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,19 @@ After you've watched these videos I'd like you to answer these questions

## 1. What do you think the most important quality for a programmer is?

patient
Positive Attitude

<!-- Write your answer here -->

## 2. When trying to solve a challenge, what should you do first?

understanding the problems

<!-- Write your answer here -->

## 3. What should you do if you get stuck?

I will go step by step through my solution trying to find where I went wrong.

<!-- Write your answer here -->
20 changes: 13 additions & 7 deletions week-7/Homework/mandatory/1-debugging-practice/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ function populateStorage() {
"127",
true
);

myLibrary.push(book1);
myLibrary.push(book2);
render();
Expand All @@ -32,13 +33,16 @@ function submit() {
title.value == null ||
title.value == "" ||
pages.value == null ||
pages.value == ""
pages.value == "" ||
author.value == null ||
author.value == ""
) {
alert("Please fill all fields!");
return false;
} else {
let book = new Book(title.value, title.value, pages.value, check.checked);
library.push(book);
// let book = new Book(title.value, title.value, pages.value, check.checked);
let book = new Book(title.value, author.value, pages.value, check.checked);
myLibrary.push(book);
render();
}
}
Expand All @@ -54,7 +58,7 @@ function render() {
let table = document.getElementById("display");
let rowsNumber = table.rows.length;
//delete old table
for (let n = rowsNumber - 1; n > 0; n-- {
for (let n = rowsNumber - 1; n > 0; n--) {
table.deleteRow(n);
}
//insert updated row and cells
Expand All @@ -76,7 +80,7 @@ function render() {
changeBut.className = "btn btn-success";
cell4.appendChild(changeBut);
let readStatus = "";
if (myLibrary[i].check == false) {
if (myLibrary[i].check == true) {
readStatus = "Yes";
} else {
readStatus = "No";
Expand All @@ -89,12 +93,14 @@ function render() {
});

//add delete button to every row and render again
let delButton = document.createElement("button");
// let delButton = document.createElement("button");
let delBut = document.createElement("button");
delBut.id = i + 5;
cell5.appendChild(delBut);
delBut.className = "btn btn-warning";
delBut.innerHTML = "Delete";
delBut.addEventListener("clicks", function () {
// delBut.addEventListener("clicks", function () {
delBut.addEventListener("click", function () {
alert(`You've deleted title: ${myLibrary[i].title}`);
myLibrary.splice(i, 1);
render();
Expand Down