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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:21:26+00:00 2026-05-26T10:21:26+00:00

I know there are a lot of how do I avoid this warning questions,

  • 0

I know there are a lot of “how do I avoid this warning” questions, but it looks like mine is the first specific to JavaScript. In this case, I want to reference the thing I’m initializing inside its own declaration, like so:

var foo = new Foo({
  bar: new Bar({
    x: function(){
      doStuff(foo);
    }
  });
});

(If this looks familiar, maybe you’ve used ExtJS before — this is how most of their stuff is built.)

When I call foo.bar.x(), I want to point back to the Foo (foo) that owns the Bar (bar) that’s calling the function (x). This works, but my Eclipse warns me that “foo may not have been initialized”, referencing the call to doStuff(); — because, when the engine first sees the line, we haven’t finished defining foo yet. Of course, x() can’t be called unless foo is constructed successfully, but my style checker apparently hasn’t figured that out.

So I’m at a loss for how to deal with this. Should I ignore the warning? Is there a way to mark it as such, so I don’t get a warning anymore? Am I doing this wrong? Should I pass my reference in a different manner?

  • 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-26T10:21:27+00:00Added an answer on May 26, 2026 at 10:21 am
    var Foo = function() { }
    
    var Bar = function (obj) {
      // foo is not initialized
      obj.x();
      // called doStuff with undefined
    }
    
    var foo = new Foo({
      bar: new Bar({
        x: function(){
          doStuff(foo);
        }
      });
    });
    

    Eclipse is right. Again if you want a better analysis system consider using WebStorm 3.0 or Visual Studio 11 as your JS IDE.

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

Sidebar

Related Questions

I know there a lot of similar questions to this, but I didn't find
I know there's a lot of questions about this but I've been struggling with
I know there's a lot of resource for this via google, but I just
I know there are a lot of similar questions to this one around Stack
I know there are a lot of other questions on SO about this topic,
I know there are a lot of questions about aligning Facebook buttons but they
I know there is a lot of controversy (maybe not controversy, but arguments at
I know there is a lot of resources about that here but yet, I
I know there are a lot of questions on how to write data from
I know there is a lot of talk about BPM these days and I

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.