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

  • Home
  • SEARCH
  • 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

I have the following function which fetches more comments beyond the 20 that are
after months of tweaking my vimrc file and installing plugins, I have this little
For the following program: int DivZero(int, int, int); int main() { try { cout
After installing one of my .Net apps on a Windows 7 machine I keep
After (another) bout with Visual Studio slowness, I went into procmon to see if
I'm using Eclipse to develop an Android app to plot Bluetooth data. The primary
As typical small-business user, when my laptop broke I HAD to upgrade to Office
Is there a difference between directly downloading a file from a web server, and
So, i found different ways to implement the creation of the singleton. EDIT: When
At this moment we are building a new architecture that is based on the

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.