Why does Javascript have privileged functions
<p>After an discussion at work, I still do not have an satisfying answer about the following, in no other programming language we speak of privileged functions.</p>

<pre><code>var kid = function(name)
{
    // Private
    var idol = "Paris Hilton";

    // Privileged
    this.get_idol = function()
    {
        return idol;
    };
}
</code></pre>

<p>The only logic I could think of is that if you make an public function return an private variable, that function is 'privileged' to do this (because you cannot call it directly). </p>

<p>We can do the same in php but we do not use this fancy name, nor can i recall any other language using this term.</p>

<p>You might even come to thing that if you need an 'privileged' function your whole approach is wrong, since if you need it accessible from the outside, why not make it public directly.</p>

<p>On the other hand the private variable cannot be changed from the outside and therefor it would become protected. but displayed to the outside.</p>

<p>In the end, as an somewhat newcomer to plain javascript, the term is somewhat confusing and imho just a fancy name to make it more confusing, because then in php it would become also like javascript : </p>

<pre><code>class kid
{
    // Private
    private idol = "Paris Hilton";

    // PUBLIC OR PRIVILEGED ? 
    public function get_idol()
    {
        echo $this-&gt;idol;
    }
}
</code></pre>

<p>it does the same but is just a public method.</p>
