js 判断是否为null(非空)
在js里总遇到判断传参是否为空的情况,但是js里面通过obj==null判断好像作用不明显,
不过通过“!”判断,事半功倍。做个小计
function replace_null(str){
if(!str){
//alert('null');
document.write('0');
}else{
document.write(str);
}
}
在js里总遇到判断传参是否为空的情况,但是js里面通过obj==null判断好像作用不明显,
不过通过“!”判断,事半功倍。做个小计
function replace_null(str){
if(!str){
//alert('null');
document.write('0');
}else{
document.write(str);
}
}
评论功能维护中,当前仅展示历史评论。
为什么我测试无效?