function Animal(name,numLegs){
this.name = name;
this.numLegs = numLegs}
Animal.prototype.sayName = function(){
console.log(\"Hi my name is \" + this.name );}
var
Because 'sayname' is inherited from 'Animal' its not 'penguin' own property.
check : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty
similar example :
function Foo() {
this.value = 'qwert';
}
Foo.prototype.say = "hello";
var foo = new Foo();
foo.hasOwnProperty("say"); // False, since say is inherited from the prototype object.
foo.hasOwnProperty("value"); // True, since value is the property of foo itself.