How to check the amount of object in an array?

0

I'm doing an ajax request, which returns an array of objects (date), how would I do a check on the number of objects?

Example:

Se (data retornar mais de um objeto no array){
    faça isso
    }senão{
    faça isso
    }
    
asked by anonymous 28.03.2018 / 16:08

1 answer

0

Try this:

if (minha_array.length > 0) {
  //true
} else {
  //false
}
    
28.03.2018 / 16:11