The first one resembles a singleton, I.E. you cannot have multiple objects of same type but with distinct state. Like it's only possible to have one actual animal in your entire application instead of many.
A more practical example, consider this page. There are multiple Posts, each with their own state (What Comments they have, what text they have, are they currently being edited and so on). If you just did var post = then that means there can only be one post. I suspect you will probably have some ad-hoc jQuery to manipulate multiple posts in that singleton but then you are not doing object oriented modeling of the problem anyway.
The second one is using constructor function incorrectly, the created objects will not be instances of Obj2 but Object. You would use a constructor like:
function Obj2() {
//initialize fields here
}
Obj2.prototype.someMethod = function(arg) {
return this.state + arg;
};
The reason returning object literal works in a constructor is that a constructor
is allowed to return objects of any type. But it doesn't make sense to make a constructor
only to return Objects.
You typically need Objects only for grouping related static functionality together (behavior, but no prolonged data)
or as a dictionary/map/associative array (data but no behavior).