Edit in JSFiddle

function Scope() {}

Scope.prototype = {
    createInnerScope: function () {
        var ChildScope = function () {};
        ChildScope.prototype = this;
        return new ChildScope();
    }
};

useCase("Variable initialized on outer scope", function () {
    var scope = new Scope();
    var innerScope = scope.createInnerScope();

    scope.foo = "Hello there!";

    log("scope.foo: " + scope.foo);
    log("innerScope.foo: " + innerScope.foo);
});

useCase("Variable initialized on inner scope", function () {
    var scope = new Scope();
    var innerScope = scope.createInnerScope();

    innerScope.foo = "Hello there!";

    log("scope.foo: " + scope.foo);
    log("innerScope.foo: " + innerScope.foo);
});








// ----------------------------------------

function useCase(title, cb) {
    log(title, "h3");
    cb();
}

function log(message, tag) {
    tag = tag || "pre";
    var body = document.querySelector("body");
    var div = document.createElement(tag);
    div.innerHTML = message;
    body.appendChild(div);
}