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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T06:45:20+00:00 2026-06-15T06:45:20+00:00

Not sure if the title is worded correctly, or if there is a better

  • 0

Not sure if the title is worded correctly, or if there is a better way of saying it, but I think its okay.

At any rate, I understand the following thus far:

a.b("a", "b", "c", foo);

Where “foo” is a function defined elsewhere that takes in no arguments would simply result in the function a.b() running, with the above parameters. The parameter “foo” can then be called inside function a.b() as simply “foo()”. In other words, I understand the above call to be using a function pointer as an argument in the function a.b as a parameter.

Okay, now here is what I’m trying to do…

I want to be able to do something similar to the above, except this time I want foo to have a paramater passed in that argument as follows:

a.b("a", "b", "c", foo("bar"));

Now here is the problem. This will literally result in the paramaters “a”, “b”, “c” and the result of foo(“bar”) being used. I don’t want this. I want foo(“bar”) to literally be passed in so that in the function a.b which would look like this (as the header):

a.b(first, second, third, fourth);

Could reference and call the fourth parameter as:

fourth();

Even if “fourth” has an argument in it. I can’t seem to find a way around this problem, any advice?

Thanks!

  • 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-15T06:45:21+00:00Added an answer on June 15, 2026 at 6:45 am

    Use an anonymous function to wrap your foo call.

    a.b("a", "b", "c", function() {return foo("bar");});
    

    If you need to retain the this value that would be given, you can invoke it using .call. You can also pass along any arguments given.

    a.b("a", "b", "c", function(arg1, arg2) {return foo.call(this, "bar", arg1, arg2);});
    

    And of course the function doesn’t necessarily need to be anonymous. You can use a named function just as well.

    function bar(arg1, arg2) {
        return foo.call(this, "bar", arg1, arg2);
    }
    a.b("a", "b", "c", bar);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm not sure if I worded the title correctly but here it goes... This
I am not sure if I worded the title correctly, but what I am
Not sure if I've worded my title correctly but here goes. I have a
I'm not sure that title is worded very well, but not sure how else
(I'm not sure if that title is worded correctly, as I'm still new to
Ok I'm not sure if I worded the title correctly, I wasn't really able
I'm not sure if I worded the title correctly. Basically is it possible to
Not sure if my title is worded well, but whatever :) I have two
I'm not entirely sure the title is properly worded, but here's the situation... I
Alright, I am not completely sure that I worded the title right, but 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.