Difference between this and something else is..?


#1

Why does this error

Animal.prototype.sayName = function(name){
console.log("Hi my name is " + name);
}

But this doesnt

Animal.prototype.sayName = function(name){
console.log("Hi my name is " + this.name);
}

They both output the same thing. So why does the first give me the error of, "It looks like your Animal.prototype.sayName method does not properly log to the console 'Hi my name is [name]' where [name] is the name of the Animal"


#2

Hi they are diferent at the console.log one have only name and the other this.name