i grok javascript scope

2007-09-29 @ 01:30#

been spending lots of time trying to 'up my javascript foo' this week. after spending time coding lots of examples, i finally understand the following (from Private Members in JavaScript by Douglas Crockford):

Public

    function Constructor(...) {

        this.membername = value;

    }
    Constructor.prototype.membername = value;

Private

    function Constructor(...) {

        var that = this;
        var membername = value;

        var membername = function(...) {...}

    }

Privileged

    function Constructor(...) {

        this.membername = function (...) {...};

    }

code