while coding I very often check if an array is empty by using JSON.stringify
It works the whole time but I am using it very often and dunno if it is proper to work with JSON.stringify to check if the array is empty.
Example:
var arr = [];
if(JSON.stringify(arr) == "[]"){
alert("Array is empty);
}
My question is not how to check if an array is empty. I ask if it is correct or inefficient in doing it that way I use it.
I know that there are plenty of ways to check if an array is empty.
Thanks