運行的時候提示export 是保留字段,請老師講解下export
(function(){var _userId = 23492; var _typeId = 'item';var export = {}; ? ?function converter(userId){return _userId;} ? ?export.getUserId = function(){return converter(_userId);} ? ?export.getTypeId = function(){return _typeId;} ? ?window.export = export; }());老師 這個例子好像有點問題,運行的時候提示export 是保留字段
2015-12-12
export 是關(guān)鍵字,改成這樣就可以了。你試試。
2015-12-12
(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;
?