Question

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.

Was it helpful?

Solution

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

It means that there is a photos tag in it.

OTHER TIPS

you can also try this.

if(place.photos){
   alert('photo tag exist');
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top