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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:07:10+00:00 2026-05-30T09:07:10+00:00

Recently I’ve been getting into Anonymous functions in a big way and wondering how

  • 0

Recently I’ve been getting into Anonymous functions in a big way and wondering how this is possible as I’m trying to re-arrange my JS code-base.

(function (listLoad, $, undefined) {
    listLoad.create = function(data)
    {
        this.init = function(data)
        {
        }
    } 
} (window.listLoad = window.listLoad || {}, jQuery));

What I’m looking to do is obviously have a number of functions for my “listLoad” page, such as “dataMap” etc, in which will all have init functions for initializing the page.

My main question is how do I access this .init function? I’m guessing it’s of private scope. I’ve tried:

listLoad.create.init = function(data)

and

 create.init = function(data)

and even init = function(data)

All to no success when writing

listLoad.create.init();

How to do this? I’m more than happy to hear certain suggestions on architecture too if you feel I’m going the wrong way about my scenario.

  • 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-30T09:07:11+00:00Added an answer on May 30, 2026 at 9:07 am

    In fact your syntax for anonymous function is not complete.

    First you must execute the annonymous block with ending parentheses:

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

    Inside the block, your code could be improved this way:

    var listLoad = {};
    
    (function (x) {
        x.create = {
            init: function(data) {
                console.log('plop');
            }
        }
    })(listLoad);
    
    
    listLoad.create.init()
    

    This provoke plop to appear logged into the console.

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

Sidebar

Related Questions

Recently I ran into this error in my web application: java.lang.OutOfMemoryError: PermGen space It's
Recently, we discovered odd behavior in some old code. This code has worked for
Recently I've been wrapping a lot of C++ code in python, and I find
recently I have seen this code arrMove = new List<int[]>(4); m_pppiCaseMoveDiagLine = new int[64][][];
Recently I have been investigating the possibilities of caching in ASP.NET. I rolled my
Recently, I've been dealing with an error with accessing MAPI via the .NET framework
Recently our site has been deluged with the resurgence of the Asprox botnet SQL
Recently a friend and I were talking about securing stored procedure code in a
Recently I have been dealing with windows LogonUser API. The LogonUser api returns different
Recently I've begun to code in Objective-C for iOS 5 devices. My brand new

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.