1.
prototype이라는 개념 자체를 제대로 이해를 못한 것 같아 질문 드립니다. prototype이 함수의 유전자를 조작한다고 하면,
function student(){
this.name = "Park";
}
student.prototype.name = "Kim";
student.prototype.gender = "Male";
var student1 = new student(); 라고 선언을 했을 시에,
student1.name은 Park가 나오고, student1.gender는 Male이 나오는 것을 확인하였는데, 이 내용을 아래와 같이 이해해도 될까요?
student()에서 이미 name = "Park"가 있고, 그 안의 유전자(prototype)에 name = "Kim"가 있어서 prototype까지 도달하기 전 존재하는 name인 "Park"가 출력되는 것.
그렇다면 이미 존재하는 name과 동일한 네이밍인 prototype.name은 사실상 실용성이 제로인건가요? 아니면 용도가 있을까요?