web(52)
-
prototype 확인- 21.html
prototype 확인 객체 리터럴 방식으로 생성된 객체는 Object.prototype 객체가 프로토타입 객체가 된다는 것을 확인 할 수 있습니다. 소스 코드 var student = { name: 'student', age: 30 }; console.log(student.toString()); console.dir(student); 출력결과 크롬 브라우저의 출력결과 Object age: 30 name: "student" __proto__: Object __defineGetter__: function __defineGetter__() { [native code] } __defineSetter__: function __defineSetter__() { [native code] } __lookupGette..
-
배열에 객체 저장- 10.html
배열에 객체 저장 학습내용 자바와 유사 동일한 패턴 사용시 소스 코드 //생성자 함수 function Student(name, korean, math, english, science){ //속성 지정 //this 전역변수로 this없으면 지역변수 this.name = name; this.korean = korean; this.math = math; this.english = english; this.science = science; //메소드 지정 this.getSum = function(){ return this.korean + this.math + this.english + this.science; }; this.getAverage = function(){ return this.getSum()/4; ..
-
Eclipse-이클립스에서 삭제된 파일 복구하기
Eclipse 이클립스에서 삭제된 파일 복구하기 Package Exploer에서 삭제한 패키지 폴더 선택 > 마우스 우클릭 > Restore from Local History… 메뉴 클릭 복구가능한 히스토리에 파일이 존재하는 경우 해당 파일 체크 후 > Restore 클릭 복가능한 히스토리가 없는 경우 메세지
-
09.html-생성자 함수를 이용한 객체 생성
생성자 함수를 이용한 객체 생성 2 소스 코드 //생성자 함수 function Student(name, korean, math, english, science){ //속성 지정 //this 전역변수로 this없으면 지역변수 this.name = name; this.korean = korean; this.math = math; this.english = english; this.science = science; //메소드 지정 this.getSum = function(){ return this.korean + this.math + this.english + this.science; }; this.getAverage = function(){ return this.getSum()/4; }; this.toStr..
-
생성자 함수를 이용한 객체 생성- 08.html
생성자 함수를 이용한 객체 생성 생성자 함수는 대문자로 시작, 명사형식 일반 함수는 소문자로 시작, 동사형식 소스 코드 //생성자 함수 function Person(name){ this.name = name; } //객체 생성 var mySon = new Person('홍길동'); //출력 document.write(mySon.name + ' '); document.write(mySon['name'] + ' '); 출력결과
-
배열과 객체의 사용- 07.html
배열과 객체의 사용 객체를 최소로 만들고, 배열의 객체에 접근해서 동적으로 배열 요소 추가 학습내용 자바에는 없는 형태 패턴이 바뀔 경우 소스 코드 //빈 객체 생성 var students = []; //객체를 배열에 저장 students.push( { name:'홍길동', korean:90, math:70, english:89, science:80 } ); students.push( { name:'이순신', korean:95, math:79, english:78, science:87 } ); students.push( { name:'유관순', korean:100, math:96, english:67, science:67 } ); students.push( { name:'일지매', korean:89, m..