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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:37:01+00:00 2026-05-14T01:37:01+00:00

I have a function function callback(obj){…} Is it okay to pass in more objects

  • 0

I have a function

function callback(obj){...}

Is it okay to pass in more objects than were declared in the function signature? e.g. call it like this:

callback(theObject, extraParam);

I tried it out on Firefox and it didn’t seem to have a problem, but is it bad to do this?

  • 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-14T01:37:01+00:00Added an answer on May 14, 2026 at 1:37 am

    JavaScript allows this, you can pass any arbitrary number of arguments to a function.

    They are accessible in the arguments object which is an array-like object that has numeric properties containing the values of the arguments that were used when the function was invoked, a length property that tells you how many arguments have been used on the invocation also, and a callee property which is a reference to the function itself, for example you could write:

    function sum(/*arg1, arg2, ... , argN  */) { // no arguments defined
      var i, result = 0;
      for (i = 0; i < arguments.length; i++) {
        result += arguments[i];
      }
      return result;
    }
    sum(1, 2, 3, 4); // 10
    

    The arguments object may look like an array, but it is a plain object, that inherits from Object.prototype, but if you want to use Array methods on it, you can invoke them directly from the Array.prototype, for example, a common pattern to get a real array is to use the Array slice method:

    function test () {
      var args = Array.prototype.slice.call(arguments);
      return args.join(" ");
    }
    test("hello", "world"); // "hello world"
    

    Also, you can know how many arguments a function expects, using the length property of the function object:

    function test (one, two, three) {
      // ...
    }
    test.length; // 3
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this static callback function in MyClass, and I try to call another
Is there a better way than this to create a callback function for some
Is it possible to call Tcl procedures that have function pointers (or callback functions)
I have this code: var getStuff = function(resources, callback, progressCallback){ var deferreds = [];
I have a callback function that checks my login details are correct - If
I want to have one callback function after actions are done, I'm trying something
I have Java application which sends pointer to function (callback) to some native dll
I have the following code, in which Boost.Local uses a function callback to load
I have a function that I use as a callback for a custom event:
I have a jQuery plugin I am trying to add a callback function for.

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.