Вопрос

I am using the google places api library and have come upon a problem, I am needing to see if the array is empty e.g if any photo exists

I have tried a few things, this being one of them.

var photoz = place.photos;

if (photoz[0] != null) {
alert('ok');
}

does anybody have any proposals to this problem.

Это было полезно?

Решение

if(place.photos != undefined){
    alert('ok');
}

It means that there is a photos tag in it.

Другие советы

you can also try this.

if(place.photos){
   alert('photo tag exist');
}
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top