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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T10:36:46+00:00 2026-06-12T10:36:46+00:00

I have a function with X arguments. I was curious if functions will accept

  • 0

I have a function with X arguments. I was curious if functions will accept an object which contains the args and still function correctly.

Example:

  var x = 0;
  var y = 0;
  var z = "test";
  someFunction(x,y,z);

vs

  var obj = new Object();
  obj.x = 0;
  obj.y = 0;
  obj.Z = "test";
  somefunction(obj);

vs.

  var obj = new Array();
  obj.push(0);
  obj.push(0);
  obj.push("test");
  somefunction(obj);

I know you could program it to handle it, but i was curious if functions would be able to accept args in different formats as long as they were all there.

Edit:

I seem to get a syntax error of sorts when collecting objects together. What do i mean? I mean i have somefunction which accepts some args, including callbacks….. so when trying to write it up, and put all the args/callbackks in an Array to do somefunction.apply(objArray), it errors on adding the items into the set. The way i did it was:

 x = new Array();
 x = [url, 
function(){
    displayFile(url, 'image', null, ft_id, null, null, null, null, !MA.isiOS());
}, 
function(e){
    if(DEBUG) console.log('Error creating gallery thumbnail');
    alert('There was a problem creating a thumbnail');
    MA.hideMessage();
}
  ];
  newArray.push(x);

it seems to mess up on the x definition set up. Does this approach not like setting up callbacks like 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-06-12T10:36:47+00:00Added an answer on June 12, 2026 at 10:36 am

    It will if obj is the Array version, and you call it using Function.prototype.apply.

    somefunction.apply(window, obj);
    

    The arguments will be passed as individuals

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

Sidebar

Related Questions

I have a function which takes two arguments, the ID of an item (wine)
I have a function which takes several boolean template arguments: template<bool par1, bool par2,
I have a function that can accept any number of arguments... const getSearchFields =
In JavaScript, if I have some function I can use the arguments object to
I would like a JavaScript function to have optional arguments which I set a
In C I have a function which registers a callback and a state object
I have a function that takes multiple arguments, some of which are boolean. I'm
I have a function in which one of the function arguments is an integer.
I have a function which will be called many times throughout my code. This
I have a function which takes four optional arguments: public function doSomething($x = null,

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.