当前位置: 动力学知识库 > 问答 > 编程问答 >

javascript - how to check if google places library place.photo array is empty

问题描述:

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');
}
分享给朋友:
您可能感兴趣的文章:
随机阅读: