I made my object a constructor function cause I did not want to put my code in another file or my object on top. Why do objects have to be initialized before use if a function does not and a function is considered an object ?
var foo_f = new Foo_methods;
var foo_o = Object.create(null);
foo_o = Object.create(foobar_obj);
foo_f.name() //Works, functions can be initialized anywhere.
foo_o.name() // Error you have to put the object on top
function Foo_methods(){
this.name = function(){ console.log("I am foo in Foo_methods")}
}
//If I put this on top or in another file it works. If I don't I get an error
//Type Error: Object prototype may only be an Object or null: undefined
var foobar_obj = {
name:function(){ console.log("I am foo in foobar_obj")}
}