Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4064756
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T15:53:47+00:00 2026-05-20T15:53:47+00:00

After an discussion at work, I still do not have an satisfying answer about

  • 0

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.

var kid = function(name)
{
    // Private
    var idol = "Paris Hilton";

    // Privileged
    this.get_idol = function()
    {
        return idol;
    };
}

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).

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.

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.

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

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 :

class kid
{
    // Private
    private idol = "Paris Hilton";

    // PUBLIC OR PRIVILEGED ? 
    public function get_idol()
    {
        echo $this->idol;
    }
}

it does the same but is just a public method.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T15:53:48+00:00Added an answer on May 20, 2026 at 3:53 pm

    Javascript doesn’t have privileged or whatever functions. All it’s functions are closures and that’s what is in use there, C# got this also and most functional languages.

    The ECMA norm for the language is available if you need, the word privileged don’t appear once inside of it.

    The term seem to come from http://www.crockford.com/javascript/private.html but it’s just a simplification of the closure concept to a specific case of their usage targeted i guess to OOP-programmer types.

    Javascript could be more powerful design-wise than most OOP languages but you need to approach it with an open mind and by understanding functional concepts. Trying to coerce it to become yet-another-OOP-language would be both a bad idea and a shame.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After a discussion about encryption, a friend of mine challenged me to crack a
After a long search I'm still confused about it although I found some related
At work we had a discussion about adding a fulltext search engine to our
I had a discussion with a colleague at work, it was about SQL queries
We have up to several team members that does not work 100% on our
Inspired by this discussion , after some googling I wasn't able to find an
After deploying WCF server (svc) on my Server, I have got this message when
After discovering about Javascript namespaces, I tried to implement them but I run into
After some time researching and trying different things I still cannot get my @ExceptionHandler
After following the RoR getting started tutorial, I added another model as: $ rails

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.