判断是json对象还是数组
根据数组有length属性而json对象没有,从而来判断
if(typeof file.length == 'number' ){ console.log('数组'); } else{ console.log('对象'); }
根据数组有length属性而json对象没有,从而来判断
if(typeof file.length == 'number' ){ console.log('数组'); } else{ console.log('对象'); }
评论
评论列表
暂无评论,快来抢沙发吧~