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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:33:38+00:00 2026-05-23T17:33:38+00:00

My programing background is that I learned a little Java in school. JavaScript syntax

  • 0

My programing background is that I learned a little Java in school. JavaScript syntax tends to confuse me for some reason. The JavaScript code below is a pattern of syntax that I don’t know what to make of:

foo.ready = function(variable){... var whatever = variable.bar();

One of my main points of confusion is the parameter. For a contrasting example, in Java, if I call a method with one parameter, the call sends one parameter. I don’t see how the parameter named ‘variable’ is ever set.

  • 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-23T17:33:38+00:00Added an answer on May 23, 2026 at 5:33 pm

    The variable is assigned when foo.ready is invoked, and passed some value (presumably a function).

    var foo = {};  // 1. Create an object named "foo"
    
      // 2. Assign a function to the "ready" property of "foo"
    foo.ready = function(variable) {
    
           // 4. "foo.ready" has been invoked, and received a function to its
           //         "variable" parameter, which it then invokes.
           //    The return value is assigned to "whatever"
         var whatever = variable();  
    
         alert( whatever );   // 5. alert the value returned from the function
    
    };
    
      // 3.  Invoke "foo.ready" passing a function as the argument.
      //         The function merely returns a string
    foo.ready( function() { return "Hello world"; } );
    

    Here’s a working example: http://jsfiddle.net/69grz/

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

Sidebar

Related Questions

Some background: I'm a jack-of-all trades, one of which is programming. I learned VB6
I am a student with a mainly electronics background getting into programing. The more
I have a background of programming in Java and C++, so I know all
I have about 4-5 years of background in programming some in C# and some
background: - there are formal languages for expressing programming language valid lexicon and syntax
For programmers that do not come from a functional programming background, are there an
Members, scholars, code gurus. My background is far from any computer programming thus my
I am developing in rails and have some programming background. I'm looking for help
I'm a person with a non-programming background working on a web application that must
Much of my programming background is in Java, and I'm still doing most of

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.