;
여기에 제목 삽입 >
/*
* 조합 모드: 생성자 모드 프로토타입 모드
이 방법은 자바스크립트에서 객체를 생성하는 가장 일반적인 방법입니다.
변수 유형 속성: 생성자를 사용하여
함수 유형을 전달합니다. 속성: 프로토타입 모드에서 선언
*/
function Student(name,age){
this.name=name
this.age=age
}
Student.prototype; .setName =function(name2){
this.name=name2;
};
Student.prototype.getName=function(){
return this.name; >
var stu1=new Student("小HU",21);
alert(stu1.getName())
;본문>