How to check the amount of object in an array?

Asked

Viewed 110 times

0

I am making an ajax request, which returns an array of objects (date), as I would do to check the amount of these objects?

Example:

Se (data retornar mais de um objeto no array){
    faça isso
    }senão{
    faça isso
    }

1 answer

0


Try this:

if (minha_array.length > 0) {
  //true
} else {
  //false
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.