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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:31:04+00:00 2026-06-16T05:31:04+00:00

function abc(arg1,arg2, callback){ console.log(arg1 + arg2) // I am doing something really interesting if(callback){

  • 0

    function abc(arg1,arg2, callback){
        console.log(arg1 + arg2) // I am doing something really interesting
        if(callback){
        callback(arg1+ arg2)
        }
    }
    function add(){
            console.log("from call back " + arguments[0])
    }

    var a =10;
    abc(1,2, add)

this works fine, but if we need to send some additional arguments to the call back, what should we do??

Here, Apart from (arg1+ arg2) I need some other arguments to be set from the caller of abc to the callback

And, what is the difference between abc(1,2,add) and abc(1,2,add()) ??

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-16T05:31:05+00:00Added an answer on June 16, 2026 at 5:31 am
    • abc(1,2,add) => Giving the function argument as “function type”. This is like giving a pointer to the function for later invoking it.

    • abc(1,2,add()) => Calling the add() function and giving its return value as argument.

    Do you need that the callback support more than an argument? Since JavaScript is a dynamic language, just call the same callback function with more arguments:

    • callback(1,2,3,4)
    • callback(1,2,3,4,5)
    • callback(1,2,3,4,5,6).

    JavaScript isn’t strict with function signatures: functions have as many arguments as the caller gives to them.

    For example, if you’ve a callback function like this:

    function(a, b) {
    
    }
    

    And later you call it this way:

    function("hello"); // Where's the second argument??
    

    JavaScript won’t complain. Simply b will be undefined.

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

Sidebar

Related Questions

Please see my exaple: var AbcVar = abc; function Abc(AbcVar){ console.log(AbcVar); } It this
I am making ajax call like this $(document).ready(function() { var abc = new Array();
<script type=text/javascript> function testing() { $.ajax({ type: POST, url: testing.php, data: call=+$(#abc).val(), success: function(msg){
I would like to call a function ABC() every 10 seconds, again and again
I need to call my function abc() , 5 seconds after the document ready
i would like to do something like this: class CCC {} function abc(array of
Something strange happens. I have in my code in a local function #ifdef abc
I want to call a parent window JavaScript function from an iframe. <script> function
function abc() { document.form1.1.disabled=true; } I have a select box whose id is 1
If I have a function like this: function abc($a,$b,$c = 'foo',$d = 'bar') {

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.