How to check if a array has something in it?

Question:
How would I check if an array is empty or has something in it? (javascript if you plz)

You can use .length and a if

if(array.length === 0){
    console.log("Empty")
}else{
    console.log("Not Empty")
}
1 Like

Yeah, I forgot about that! Thanks for replying though!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.