您的位置:首页 > 技术中心 > 前端框架 >

javascript如何判断字符是否为空

时间:2021-04-09 15:03

javascript判断字符是否为空的方法:首先判断字符是否为空,代码为【if(typeof res== "undefined" || res== null || res== "")】;然后通过js调用即可。

本教程操作环境:windows7系统、javascript1.8.5版,DELL G3电脑。

javascript判断字符是否为空的方法:

js代码:

//判断字符是否为空的方法
function IsEmpty(res){
    if(typeof res== "undefined" || res== null || res== ""){
        return true;
    }else{
        return false;
    }
}

js调用:

if (!IsEmpty(value)) {
    alert(value);
}

相关免费学习推荐:javascript(视频)

以上就是javascript如何判断字符是否为空的详细内容,更多请关注www.gxlsystem.com其它相关文章!

本类排行

今日推荐

热门手游