이것은 출처 인 Codecademy에서 잘 작동하는 코드입니다. 그러나 브라우저에서 동일한 코드를 사용하면 정의되지 않은 값이 반환됩니다.JavaScript 프로토 타입 브라우저 출력
<script>
function Cat(name, breed) {
this.name = name;
this.breed = breed;
}
Cat.prototype.meow = function() {
console.log('Meow!');
};
var cheshire = new Cat("Cheshire Cat", "British Shorthair");
var gary = new Cat("Gary", "Domestic Shorthair");
alert(console.log(cheshire.meow));
alert(console.log(gary.meow));
</script>
console.log는 undefined를 반환합니다. – maioman