Home > database >  ( if steatmetn), even if the value is null when I click the button it delete the items
( if steatmetn), even if the value is null when I click the button it delete the items

Time:06-15

in the if statement, even if the value is null, when I click the button, it is still deleting the item which is in the array. I would be happy if you guys help, I have no idea.

[1]:

here is the picture https://i.stack.imgur.com/0Pm5K.png

CodePudding user response:

You need to remove comparison with null, I mean next:

if(dele){
   ....
} else {
   alert('Put a value');
}

CodePudding user response:

In this statement, I have smiler problem, even if I the value is null, still adds a product to the array.[enter image description here][1]

Link is here: https://i.stack.imgur.com/lcD3u.png

– sashok1337

  • Related