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 8479643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:05:23+00:00 2026-06-10T19:05:23+00:00

Each function object should have two hidden properties ( per JavaScript The Good Parts,

  • 0

Each function object should have two “hidden” properties ( per JavaScript The Good Parts, The Functions Chapter )

context

and

code

Is there a way to access these properties?

  • 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-06-10T19:05:25+00:00Added an answer on June 10, 2026 at 7:05 pm

    Well, you can access the function code pretty easily – by using toString() (or Mozilla’s non-standard toSource()):

    var x = function() { alert('Here is my happy function'); };
    console.log(x.toString());
    

    As for context, I suppose DC meant more than simple this, and actually wrote about Execution Context.

    UPDATE: Have found an interesting snippet in ES5 specification, where these two properties are actually described in some details – and not as abstract concepts:

    13.2 Creating Function Objects

    Given an optional parameter list specified by FormalParameterList, a
    body specified by FunctionBody, a Lexical Environment specified by
    Scope, and a Boolean flag Strict, a Function object is constructed as
    follows:

    …

    Set the [[Scope]] internal property of F to the value of Scope.

    …

    Set the [[Code]] internal property of F to FunctionBody.

    At the same time:

    Lexical Environments and Environment Record values are purely
    specification mechanisms and need not correspond to any specific
    artefact of an ECMAScript implementation. It is impossible for an
    ECMAScript program to directly access or manipulate such values.

    So I guess that closes the question about accessing Scope property of function.

    As for Code property, its read-only accessing with toString(), as was rightly noticed by Matt, is implementation-dependent – yet is more often implemented than not. )

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

Sidebar

Related Questions

In most other Object Oriented languages. it would be sacrilege to have each function
I have some ajax calls in multiple JavaScript functions. Each one does a post
i want to get the height property of a object: $('.selector img').each(function(index,e){ thisImage =
I have the following: $(span.findme).each(function() { $(<li>).text($(this).text()).appendTo(ul); }); How can I, using the above,
I've objects of array, in each object i have different type of strings in
It is generally accepted that Javascript code should be wrapped in a function to
I am considering whether it is better to have two pointers, one for each
I have a class with two methods load() and getValue(). The load function loads
$(function(){ $('a').each(function(){ var x=this.href; this.href=www.somesitename.com/filter+this.href; }); }); i wrote the above jQuery script to
Having trouble with each function... Will try to explain by example... In my code,

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.