Return to Snippet

Revision: 20363
at November 13, 2009 09:31 by rccc


Initial Code
/* Public */

    function Constructor(...) {

        this.membername = value;

    }
    Constructor.prototype.membername = value;

/* Private */

    function Constructor(...) {

        var that = this;
        var membername = value;

        function membername(...) {...}

    }

    Note: The function statement

        function membername(...) {...}

    is shorthand for

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

/* Privileged */

    function Constructor(...) {

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

    }

Initial URL
http://www.crockford.com/javascript/private.html

Initial Description

                                

Initial Title
javascript private and privileged members

Initial Tags
javascript

Initial Language
JavaScript