I have following object in `JavaScript`. I am confused in how to access `object.demo()` and `object.demo.inner()`. The `object.demo.inner()` worked fine but `object.demo` is not working. I have the requirement that the name should be same. Why is the function not overloading here?

```
var object = {
    // object.demo()
    demo: function(str, pathStr) {
        console.log('function 1')
    },

    demo: {
         // object.demo.inner()
        inner: function () {
            console.log('inner')
        }
    }
}

object.demo.inner() //working
object.demo() //not working

```