var single = (function(){ var unique; function getInstance(){ if( unique === undefined ){ unique = new Construct(); } return unique; } function Construct(){ // ... 生成單例的構造函數的代碼 } return { getInstance : getInstance } })();