Skip to content

Commit eb7a6bd

Browse files
committed
add validtion for pagesvalue
1 parent d34f4fd commit eb7a6bd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

debugging/book-library/script.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function submit() {
3535
const titleValue = titleInput.value.trim();
3636
const authorValue = authorInput.value.trim();
3737
const pagesValue = Number(pagesInput.value);
38-
if (!titleValue || !authorValue || !pagesValue || pagesValue < 0) {
38+
if (!titleValue || !authorValue || Number.isFinite(!pagesValue) || pagesValue <= 0) {
3939
alert("Please fill all fields!");
4040
return;
4141
} else {

0 commit comments

Comments
 (0)