//闭包的封装
(function(){
var _userID=123;
var _typeID="item";
var myExport={};
function converter(userID){
//个人认为这些函数就是闭包
return +userID;
}
myExport.getUserID=function(){
return converter(_userID);
}
myExport.getTypeID=function(){
return _typeID;
}
window.myExport=myExport;
})();
var a=myExport.getUserID();
var b=myExport.getTypeID();
var c=myExport._userID;
console.log(a);
console.log(b);
console.log(c);
//123
//item
//undefined