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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:34:08+00:00 2026-06-13T07:34:08+00:00

This question looks like a duplicate, as the title is nearly replicated. But, my

  • 0

This question looks like a duplicate, as the title is nearly replicated. But, my issue seems simpler and I can’t find the answer to it.

I have a Javascript function that executes another callback function, it works like this:

<script type='text/javascript'>
firstfunction(callbackfunction);
</script>

where callback function is defined as:

callbackfunction(response) {
    if (response=='loggedin'){
    // ... do stuff
}}

but I want it to be something like this:

callbackfunction(response, param) {
    if (response=='loggedin'){
    // ... do stuff with param
}}

My question is, does it work to pass the parameter like this:

<script type='text/javascript'>
firstfunction(callbackfunction(param));
</script>

or am I doing it wrong?

  • 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-13T07:34:09+00:00Added an answer on June 13, 2026 at 7:34 am

    In direct answer to your question, this does not work:

     firstfunction(callbackfunction(param));
    

    That will execute callbackfunction immediately and pass the return value from executing it as the argument to firstfunction which is unlikely what you want.


    It is unclear from your question whether you should just change firstfunction() to pass two parameters to callbackfunction() when it calls the callback or whether you should make an anonymous function that calls the callback function with arguments.

    These two options would look like this:

    function firstfunction(callback) {
        // code here
        callback(arg1, arg2);
    }
    
    firstfunction(callbackfunction);
    

    or

    function firstfunction(callback) {
        // code here
        callback();
    }
    
    firstfunction(function() {
        callbackfunction(xxx, yyy);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

It looks like this question has been asked dozens of times, but none of
Looks like this question has been asked thousand times already, but each person's configuration
Problem: I have a string that looks like this: [1=>2,3,4][5=>6,7,8][9=>10,11,12][13=>14,15][16=>17,18] Question: How can you
This question may be a duplicate of this question , but I can't get
i know this question might look like a duplicate. but i had a hard
Quick question... I have a query that checks for duplicates that looks like this:
Okay guess this question looks a lot like: What is the best way to
Absolute beginner question: I have a template file index.html that looks like this: ...
Noob question here! I have an array with hashes that looks like this: arr
This might look like a basic question to some of you but I expect

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.