function outer() { function inner() { console.log("hi"); } return { inner: inner }; } var foo = outer(); foo.inner();