We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 556cd3e commit 43b06b0Copy full SHA for 43b06b0
debugging/book-library/script.js
@@ -28,17 +28,12 @@ const check = document.getElementById("check");
28
//check the right input from forms and if its ok -> add the new book (object in array)
29
//via Book function and start render function
30
function submit() {
31
- if (
32
- title.value == null ||
33
- title.value == "" ||
34
- pages.value == null ||
35
- pages.value == ""
36
- ) {
+ if (!title.value || !author.value || pages.value <= 0) {
37
alert("Please fill all fields!");
38
return false;
39
} else {
40
- let book = new Book(title.value, title.value, pages.value, check.checked);
41
- library.push(book);
+ let book = new Book(title.value, author.value, pages.value, check.checked);
+ myLibrary.push(book);
42
render();
43
}
44
0 commit comments