Skip to content

Instantly share code, notes, and snippets.

@khg0712
Created May 30, 2018 10:49
Show Gist options
  • Save khg0712/edf472e5b3f7aa3099ef305abf645c8f to your computer and use it in GitHub Desktop.
Save khg0712/edf472e5b3f7aa3099ef305abf645c8f to your computer and use it in GitHub Desktop.
생성자 함수로 생성된 객체의 프로토타입 체이닝
function Animal(name, age, species) {
this.name = name;
this.age = age;
this.species = species;
}
var frog = new Animal('froll', 2, 'frog');
console.log(frog.hasOwnProperty('name'));//true 출력
console.log(frog.hasOwnProperty('fatherName'));//false 출력
console.dir(Animal.prototype);//Animal.prototype 객체
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment