How do you check that data.results in the following is not empty before trying to perform actions on it?
$.getJSON(myurl, function(data) {
  // if开发者_StackOverflow中文版 data.results is not empty 
  // {
  //    console.log(data.results.size);
  // }
});
if (data != null && data.results != null && data.results.length > 0) {
    // the array is not empty
}
I usually use something like this:
if (data != null && data.results != null && data.results.size != 0) ...
how about doing this one?
if(data!=undefined){
// do logic here
}
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论