JavaScript面向对象的方法实现继承:call方法

来源:互联网 发布:1314158淘宝信誉查询 编辑:程序博客网 时间:2024/05/24 05:03

MyTool = new function(){
        /**
         * 返回非空字符串,如果有默认值就返回默认字符串.
         */
        this.notNull = function(str,defaultStr){
                if(typeof(str)=="undefined"||str==null||str==''){
                        if(defaultStr)
                                return defaultStr;
                        else
                                return '';
                }
                else{
                        return str;
                }
        }
}

rootId = MyTool.notNull(rootId,'001000'); 

原创粉丝点击