You get the first error (mammal.prototype - undefined) because the mammal is an object, the prototype property is added to function objects when they are created , and they should be used when you want to have function constructors .
I think that you are misleading this property with the internal [[Prototype]] property.
The [[Prototype]] property can be set only by the new operator, through the internal [[Construct]] operation.
This property is not available (although there are some ways, for example, in the implementation of Mozilla obj.__proto__; or the new ECMAScript 5 Object.getPrototypeOf ).
About the second question, you get these errors because you are creating a new object that inherits from the function and not from another object.
What about:
var mammal = { color: "brown", getColor: function(){ return this.color; }, kindOf: "mammal"
In the above snippet, all instances inheriting from the mammal will have the kindOf property, which can later be changed when creating more specific mammalian objects.
Edit: In response to your comment, yes, the language itself gives you a tool to know that Object.prototype.hasOwnProperty , it returns a logical result indicating whether the object has a physically specified property or not, for example:
var obj = { foo: 'bar' }; obj.hasOwnProperty('foo'); // true obj.hasOwnProperty('toString'); // false, inherited from Object.prototype
You can also call this method directly on Object.prototype , so if someone calls the hasOwnProperty property for the object, it will not fail:
Object.prototype.hasOwnProperty.call(obj, 'foo');