There was an error while loading. Please reload this page.
1 parent 7f5941f commit ff58ce9Copy full SHA for ff58ce9
1 file changed
debugging/book-library/script.js
@@ -38,7 +38,14 @@ function addBook() {
38
// Preprocessing / validation:
39
// - reject empty or whitespace-only title/author (checked AFTER trim, not before)
40
// - reject non-numeric or non-positive page counts
41
- if (!title || !author || !pagesRaw || !Number.isFinite(pages) || pages <= 0) {
+ if (
42
+ !title ||
43
+ !author ||
44
+ !Number.isInteger(pages) ||
45
+ pages <= 0
46
+) {
47
+ // invalid
48
+}
49
alert("Please fill all fields with valid values!");
50
return false;
51
}
0 commit comments