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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:56:00+00:00 2026-06-05T16:56:00+00:00

My basic setup is a whole heap of Javascript under an anonymous self-invoking function:

  • 0

My basic setup is a whole heap of Javascript under an anonymous self-invoking function:

(function () {
    ...
})();

My problem is that I can’t seem to get access to the objects within this ASI function via the DOM tab. I tried both the following:

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

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

The first didn’t fire at all. The second just said MYAPP is undefined in the DOM tab.

Is there a way around this?

  • 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-05T16:56:02+00:00Added an answer on June 5, 2026 at 4:56 pm

    In your first version, you are simply creating a function with the name MYAPP, but you are not executing it.

    In the second version, your function is executed and its result is assigned to MYAPP. But your function does not seem to return anything, so MYAPP stays undefined.

    See A Javascript Module Pattern on YUIBlog for an explanation of this pattern. Their example goes like this:

    YAHOO.myProject.myModule = function () {
    
        return  {
            myPublicProperty: "I'm accessible as YAHOO.myProject.myModule.myPublicProperty.",
            myPublicMethod: function () {
                YAHOO.log("I'm accessible as YAHOO.myProject.myModule.myPublicMethod.");
            }
        };
    
    }(); // the parens here cause the anonymous function to execute and return
    

    So your function basically returns an object containing all the public members. You can then access these with Firebug, too.

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

Sidebar

Related Questions

The basic setup is classic - you're creating a Windows Forms application that connects
I have a parent-child relationship setup that is fairly basic. The end result is
I set up the basic Authentication/Authorization set up, but a problem now is that
I have a problem with databinding on a style in WPF. The basic setup
I'm trying to create a very basic Setup and Deployment project using Visual Studio.
I have setup the basic LAMP server on Ubuntu 11.10 and had a few
I used generate scaffold to setup the basic RESTful actions however I want to
Just a basic html link question. I have an intranet setup, and I need
Can anyone psuedo a solution to my problem, or just give discussion to help
I'm using the Drupal Quiz module, and have setup some basic quizzes and stuff

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.