생성자 함수(2)
-
function() 생성자 함수를 통한 함수 생성
function() 생성자 함수를 통한 함수 생성 Function( )생성자 함수 소스 코드 출력결과 Function( )생성자 함수 일반적으로 자주 사용되지 않으므로 소스 분석 수준으로만 알아두기 바랍니다. var 함수= new Function (arg1, arg2, arg3,…… argN, functionBody) arg1, arg2, arg3,…… argN 함수의 매개변수 functionBody 함수가 호출될 때 실행되는 코드를 포함한 문자열 소스 코드 출력결과
-
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..