Skip to content
This repository was archived by the owner on Aug 5, 2021. It is now read-only.
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,15 @@ 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?

<!-- Write your answer here -->
problem solving

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

<!-- Write your answer here -->
understanding the problem
divide the task into smaller units

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

<!-- Write your answer here -->
debugging
research
discuss with team
28 changes: 15 additions & 13 deletions week-1/Homework/mandatory/1-debugging-practice/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,21 @@ const check = document.getElementById("check");
function submit() {
if (
title.value == null ||
title.value == "" ||
author.value == "" ||
pages.value == null ||
pages.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, author.value, pages.value, check.checked);
myLibrary.push(book);
render();
}
}

function Book(title, author, pages, check) {

this.title = title;
this.author = author;
this.pages = pages;
Expand All @@ -54,7 +55,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,25 +77,26 @@ function render() {
changeBut.className = "btn btn-success";
cell4.appendChild(changeBut);
let readStatus = "";
if (myLibrary[i].check == false) {
readStatus = "Yes";
} else {
// alert(myLibrary[i].check)
if (myLibrary[i].check === false) {
readStatus = "No";
} else {
readStatus = "Yes";
}
changeBut.innerHTML = readStatus;

changeBut.addEventListener("click", function () {
myLibrary[i].check = !myLibrary[i].check;
render();
});

//add delete button to every row and render again
let delButton = document.createElement("button");
delBut.id = i + 5;
cell5.appendChild(delBut);
delBut.className = "btn btn-warning";
delBut.innerHTML = "Delete";
delBut.addEventListener("clicks", function () {
delButton.id = i + 5;
cell5.appendChild(delButton);
delButton.className = "btn btn-warning";
delButton.innerHTML = "Delete";
delButton.addEventListener("click", function () {
alert(`You've deleted title: ${myLibrary[i].title}`);
myLibrary.splice(i, 1);
render();
Expand Down
7 changes: 7 additions & 0 deletions week-1/Homework/mandatory/2-project/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# tv-show-dom-project

A starting point for CYF's TV show DOM project

The requirements for the project are here:

https://github.com/CodeYourFuture/syllabus/tree/master/js-core-3/tv-show-dom-project/readme.md
29 changes: 29 additions & 0 deletions week-1/Homework/mandatory/2-project/episodes.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>TV Show Project | zubeda (zubedauk)</title>
<link href="style.css" rel="stylesheet" />
<link href="show.css" rel="stylesheet">
<link rel="icon" href="/favicon.ico" type="image/x-icon" />
</head>
<body>
<div id="container">
<div id="episode-container" style="display:block">
<div id="search"></div>
<hr style="margin-top: 0.2rem;">
<div id="root-grid"></div>
</div>
</div>
<!--load shows-->
<script src="shows.js"></script>
<!-- Loads a provided function called getAllEpisodes() which returns all episodes -->
<script src="episodes.js"></script>

<!-- Loads YOUR javascript code -->
<script src="script.js"></script>
<!--load your js code 500 level and above 500-->
<script src="script500.js"></script>
</body>
</html>
Loading