且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

JavaScript检查json输出是否为空

更新时间:2022-04-10 07:28:17

要检查数组是否为空,只需使用相应的

To check whether your array is empty, just use the respective length property:

if ( data['items'].length < 1 ) {
   // it's empty
}