JQuery 判断是否为空

版权声明:Hi https://blog.csdn.net/qq_33417486/article/details/83155637

判断对象是否为空:

if(isEmpty(obj)){
    ...
}else{
    ...
}



function isEmpty(obj){
    for(var o in obj){
        return false;
    }
    return true;
}

判断对象是否为null

if(obj == null){
    ...
}

猜你喜欢

转载自blog.csdn.net/qq_33417486/article/details/83155637