lundi 25 novembre 2019

How to know if array / object is empty after delete function?

var arr = [30];
delete arr[0];
if (arr.length == 0) {
alert("empty");
}

This code won't work only because of delete. Is there an ultimate way to check if the array is empty no matter what?

Thanks :)

Aucun commentaire:

Enregistrer un commentaire