Why does the following object factory pattern code return false...
var Animal = function(name) {
var temp = new Object();
temp.name = name;
return temp;
}
var animal = Animal("fox");
console.log(animal instanceof Animal);
...while the following constructor pattern code returns true;
var Animal = function(name) {
this.name = name;
}
var animal = new Animal("fox");
console.log(animal instanceof Animal);