すべて、私はjavascript OOに精通していません。それを試してみた後、オブジェクト定義について少し混乱した質問があります。以下のコードとコメントを確認してください。ありがとうございます。
GlobalUtility = function() {
this.templeteCode = "123";
this.Init();
//why can not put this code here,
//there is an error says GetOriginalSource is not a function .
//This is not like the classical OO constructor which can call any methods in class.
this.Init = function() {
var source=this.GetOriginalSource();
alert(source + " is ok.");
},//I found I can end this statement by , or ; Is there any difference between them?
this.GetOriginalSource=function(){
return "abc";
};
//this.Init(); putting this code here is ok .
};