I'm assigning a named function expression to a property of an object:
var foo = {};
foo.bar = function bar(){
    console.log('bar');
};
- foo.bar()=> bar
- bar()=> ReferenceError: bar is not defined
Why can't I call bar() directly, why isn't it defined?
I know that I can simply chain the assignment like var bar = foo.bar = function(){}, so I'm not looking for a work-around or other solution, I'm only interested in why it doesn't work.
I've tested in Chrome console and Node.JS.
 
    