일 때 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 .
};
나는이 질문 codeReview' 또는'Programmers''로 이동 될 필요가 있다고 생각 재미 없습니다. – Red
안녕하세요, @ Red, codeReview 및 Programmers는 어디 있습니까? 제게 링크를 제공해 주시겠습니까? 다음에 나는 그것을 따라갈 것이다. 감사합니다. –
http://programmers.stackexchange.com/?as=1, http://codereview.stackexchange.com/?as=1 또한 놀라운 스택 사이트를 확인하십시오. – Red