Skip to content

Commit 49305b0

Browse files
committed
fix validtion
1 parent 02a6b5f commit 49305b0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

debugging/book-library/script.js

Lines changed: 2 additions & 2 deletions
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 || !Number.isFinite(pagesValue) || pagesValue <= 0) {
38+
if (!titleValue || !authorValue || !Number.isInteger(pagesValue) || pagesValue <= 0) {
3939
alert("Please fill all fields!");
4040
return;
4141
} else {
@@ -89,7 +89,7 @@ function render() {
8989

9090
//add delete button to every row and render again
9191

92-
let deleteBut = document.createElement("button");
92+
const deleteBut = document.createElement("button");
9393
deleteCell.appendChild(deleteBut);
9494
deleteBut.className = "btn btn-warning";
9595
deleteBut.textContent = "Delete";

0 commit comments

Comments
 (0)