Skip to content

Commit 09081dd

Browse files
committed
refactor and add author validtion
1 parent 48c8f6c commit 09081dd

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

debugging/book-library/script.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,11 @@ const check = document.getElementById("check");
3030
//via Book function and start render function
3131
function submit() {
3232
//if any of the information is missing show an alert
33-
if (
34-
title.value == null || // == checks both null and undefined . === only null
35-
title.value == "" || // why you use the way and where author check??
36-
pages.value == null || // if(!title.value||author.value|| page.value) is more clear and readable
37-
pages.value == ""
38-
)
33+
if (!title.value || !author.value ||!pages.value)
34+
// == checks both null and undefined . === only null
35+
// why you use this way and where author check??
36+
// if(!title.value||author.value|| page.value) is more clear and readable
37+
3938
{
4039
alert("Please fill all fields!"); // alert is a built-in JS function
4140
return false;

0 commit comments

Comments
 (0)