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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:14:39+00:00 2026-05-26T08:14:39+00:00

I have recently been messing around with jQuery on my website, and I have

  • 0

I have recently been messing around with jQuery on my website, and I have a fairly limited knowledge of Javascript. I am beginning to like the jQuery ability to pass variables to a jQuery function inside the curly braces, like so:

$(somediv).animate({thisisone: 1, thisistwo: 2}, thisisavar);

What I was wondering is how I can write a Javascript function that I can pass items to inside the curly braces? I know you can write functions like this:

function someName(var1, var2, var3...) {

}

but that doesn’t support the braces? I also know that you can add no arguments and do this:

function accident() {
    for( var i = 0; i < arguments.length; i++ ) {
        alert("This accident was caused by " + arguments[i]);
    }
}
accident("me","a car","alcohol","a tree that had no right to be in the path of my driving");

but I also want to pass outside variables instead of just a whole line of strings, if that makes sense?

Basically, I want a function that I can pass variables to, like so:

function myFunction(neededcodehere){
    //Some code here...
}

myFunction (var1, {"Option 1", "Option 2", "Option 3"}, anothervar);
  • 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-26T08:14:39+00:00Added an answer on May 26, 2026 at 8:14 am

    The "braces" are making an object literal, i.e. they create an object. It is one argument.

    Example:

    function someFunc(arg) {
        alert(arg.foo);
        alert(arg.bar);
    }
    
    someFunc({foo: "This", bar: "works!"});
    

    the object can be created beforehand as well:

    var someObject = {
        foo: "This", 
        bar: "works!"
    };
    
    someFunc(someObject);
    

    I recommend to read the MDN JavaScript Guide – Working with Objects.

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

Sidebar

Related Questions

Yeah so I've been messing around with javascript a while but only recently got
I've recently taken the plunge into DirectX and have been messing around a little
I'm just messing around with Javascript and JQuery and I've been trying to achieve
I have recently been messing around with SFML , a multimedia library. I use
Recently I've been messing around a fair amount with OpenGL, and I have come
I have recently been using WxPython to create a GUI Network simulator like Cisco
Possible Duplicate: Start thread with member function I have recently been playing around with
I've been messing around with this for some time. I recently started using the
Ok, so I have recently been looking at block caching in magento. Looks like
I have recently been messing with form submission and I was making a Python

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.