(function(){ var _userId=2334; var _typeId="item";var export={}; function converter(userId){return +userId;} function getUserId(){return converter(_userId);} function getTypeId(){return converter(_typeId);} window.export=export; }()); alert( export.getUserId() );怎么提示 var export={};有错呢
(function(){
var _userId = 23492;
var _typeId = 'item';
var export1 = {};
function converter(userId){
return +userId;
}
export1.getUserId = function(){
return converter(_userId);
}
export1.getTypeId=function(){
return _typeId;
}
window.export=export1;
}());
window.export.getUserId();
window.export.getTypeId();
window.export._userId;
window.export._typeId;
window.export.converter;
export报错提示是这个单词是个关键字。改成如上所示即可。
export报错提示是这个单词是个关键字。
(function(){
var _userId=2334;
var _typeId="item";
var export={};
function converter(userId){
return +userId;
}
function getUserId(){
return converter(_userId);
}
function getTypeId(){
return converter(_typeId);
}
window.export=export;
}());
alert( export.getUserId() );
}
这里怎么有错误呢