function Person(name, age) { this.name = name; this.age = age; } Person.prototype.sayName = function() { document.write(this.name); } function Student(name, age, major) { Person.call(this, name, age); this.major = major; } var student1 = new Student("sin", 27, "컴퓨터과학과"); document.write(student1.name + "<br>"); // sin document.write(student1.major + "<br>"); // 컴퓨터과학과 try { student1.sayName(); // 프로토타입상속이 아니어서 사용할 수 없음 } catch (err) { document.write(err); // TypeError: student1.sayName is not a function }