我對使用AMD編寫JavaScript代碼頗爲陌生。我停留在搞清楚如何在一個文件中寫入多個功能:在AMD javascript模塊中編寫多個函數
define(function(){
return {
and: function(a,b){
return (a&&b);
}
};
}
);
我試着按以下方式寫另一功能plus
:
define(function(){
return {
plus: function(a,b){
return (a+b);
}
};
}
);
但是當我使用咕嚕進行測試,它是無法檢測到功能加
你想要什麼?定義2個_spearate_函數或具有兩個函數的_one_對象? –
2個獨立的函數 – user1692342