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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T01:07:31+00:00 2026-05-30T01:07:31+00:00

In Chrome, when I type console.log in the one below: console.log(A parameter, A parameter,

  • 0

In Chrome, when I type console.log in the one below:

console.log("A parameter", "A parameter", "A parameter", "A parameter", "A parameter", "A parameter", "A parameter", "A parameter", "A parameter", "A parameter", "A parameter", "A parameter", "A parameter");

…it prints it correctly, with no errors or warnings. I appended more parameters, but it still prints it out correctly.

console.log("A parameter", "A parameter", "A parameter", "A parameter", "A parameter", "A parameter", "A parameter", "A parameter", "A parameter", "A parameter", "A parameter", "A parameter", "A parameter", "A parameter", "A parameter", "A parameter", "A parameter", "A parameter", "A parameter", "A parameter", "A parameter", "A parameter", "A parameter", "A parameter", "A parameter", "A parameter", "A parameter", "A parameter", "A parameter", "A parameter", "A parameter");

How can I have an “infinite” parameter function just like that one?

  • 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-30T01:07:34+00:00Added an answer on May 30, 2026 at 1:07 am

    Functions can access an array-like object called arguments that contains all the arguments that they received

    function print_my_arguments(/**/){
        var args = arguments;
        for(var i=0; i<args.length; i++){
            console.log(args[i]);
        }
    };
    

    And you can do the opposite conversion (call a function given a list of arguments) with the apply method:

    // These are equivalent:
    print_my_arguments(1,2,3);
    print_my_arguments.apply(null, [1,2,3]);
    
    // The first parameter to `apply` is the `this`.
    // It is used when the function is a method.
    foo.bar(1,2,3);
    var f = foo.bar; f.apply(foo, [1,2,3]);
    

    Some important points to note:

    1. arguments isn’t an actual array and it has none of the usual array methods (slice, join, etc). You can convert it to an array with the following line:

      var args = Array.prototype.slice.call(arguments);
      
    2. Slice is also useful if you want your array to only contain the non-named arguments that were received:

      function foo(first_arg, second_arg /**/){
          var variadic_args = Array.prototype.slice.call(arguments, 2);
      }
      
    3. Not every browser can handle an arbitrarily large number of function parameters. Last time I tested this, in Chrome and IE there was a stackoverflow after some 200.000 arguments. If your function can receive an arbitrarily large number of arguments, consider packing all of those arguments in an regular array instead.

    4. Those /**/ comments that appear in the arguments lists for my examples are not mandatory. They are just a coding a convention that I use to mark my variadic functions and differentiate them from regular functions.

      // A quick glance would suggest that this function receives no
      // parameters but actually it is a variadic function that gets
      // its parameters via the `arguments` object.
      function foo(){
          console.log(arguments.length);
      }
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to distinguish 0 from 0 in Firebug console.log output. If you type
In chrome's console, when I type: > switch(3){default:OK} OK So looks like the switch
I am trying to run this in Chrome/Firefox Console but not having any luck.
When I open console of Chrome 14 and type... require (or require() , if
When Google's main page communicates with Firefox or Chrome it uses a particular type
I have the following code that works on Firefox and Chrome $("#adicionarItem").click(function(){ $.ajax({ type:
Chrome v4 supports the placeholder attribute on input[type=text] elements (others probably do too). However,
I have the following ajax call which works perfectly in Firefox and Chrome but
Jquery works fine. Everything is functional. If I open up console and type :
I want to create an observableArray. The code below prints 6 : 0 and

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.