I'm using an example from here.
    function Restaurant() {
        this.mongoose = 'beans';
        this.freedom = {bear: 'love', a: 12};
    
        var myPrivateVar;
    
        // Only visible inside Restaurant()
        var private_stuff = function() {
            myPrivateVar = "I can set this here!";
            this.mongoose = 12;
            this.freedom.a = 14; // <= 'a' undefined 2nd time
        }
        // use_restroom is visible to all    
        this.use_restroom = function() {
            private_stuff();
        }
        // buy_food is visible to all    
        this.buy_food = function() {
            private_stuff();
        }
    
        private_stuff.call(this);
    }
    
    var bobbys = new Restaurant();
    bobbys.buy_food() // <= failsI set this.freedom.a to 14 in private_stuff() and then I call bobbys.buy_food().
When that function is called, this.freedom apparently is undefined, so I can't set a.
Does anybody know why it fails on freedom and not on mongoose?
I appreciate comments, but if someone posts an 'Answer', then I can close this as solved, and give you the credit.
 
     
    