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

Advertisements

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

>Solution :

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

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

Leave a ReplyCancel reply