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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T15:09:55+00:00 2026-06-02T15:09:55+00:00

Possible Duplicate: Javascript syntax: what comma means? What does this pattern return? How does

  • 0

Possible Duplicate:
Javascript syntax: what comma means?

What does this pattern return? How does it work?

return myfunc(), myobj.myvar = someobj.prop, myobj

I have not come across this pattern before but have been looking at the Bing Maps Ajax Control and have noticed this pattern several times.

As I understand it multiple values are not returned. So what does this pattern do? What is returned? What is this pattern’s benefit?

  • 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-02T15:09:57+00:00Added an answer on June 2, 2026 at 3:09 pm

    It’s the comma operator. It evaluates its left-hand operand, throws the result away, evalutes its right-hand operand, and takes that as its result value. It’s left-to-right associative, so a, b, c evaluates a, then b, then c, and takes the result of c as its value.

    In your example, it’s exactly like:

    myfunc();
    myobj.myvar = someobj.prop;
    return myobj;
    

    Some people really prefer to do things on one line, even when there’s no objective reason to. There no benefit in the example you gave, and in fact it’s confusing because it makes it look like the first two bits relate to the value that will ultimately be returned, which they don’t. (I wrote that before you told us it was minified code; obviously, being unclear to humans is only an issue in source code, not minified code.)

    Since you’ve said it’s a minifier: The very small possible benefit the minifier might have gotten there is if this is part of a conditional block: It can save one or two characters. If we assume the long form looked like this:

    if (someCondition) {
        myfunc();
        myobj.myvar = someobj.prop;
        return myobj;
    }
    

    …using the comma operator, the minifier can do this (63 characters):

    if(someCondition)return myfunc(),myobj.myvar=someobj.prop,myobj
    

    …rather than this (65 characters):

    if(someCondition){myfunc();myobj.myvar=someobj.prop;return myobj}
    

    …without changing the functionality of the code, if what follows is a } or some other appropriate character (or end-of-file) to trigger automatic semicolon insertion at the end. Otherwise, it would need the ; on the first one, but that still saves one character.

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

Sidebar

Related Questions

Possible Duplicate: Question on this JavaScript Syntax (“What Does This Do?”) What is the
Possible Duplicate: What does this JavaScript/jQuery syntax mean? I specifically mean when you do
Possible Duplicates: How does this JavaScript/JQuery Syntax work: (function( window, undefined ) { })(window)?
Possible Duplicate: Question on this JavaScript Syntax (“What Does This Do?”) in this article
Possible Duplicate: What do parentheses surrounding a JavaScript object/function/class declaration mean? What does this
Possible Duplicate: Javascript syntax I haven't seen till now, what does it do really?
Possible Duplicate: What does this mean? (function (x,y)){…}){a,b); in JavaScript Please anyone explain and
Possible Duplicate: JavaScript BlockStatement confusion Why does {10 + '1'} + 10 equal 10?
Possible Duplicate: javascript WYSIWYG HTML editors? Im not quite sure how to put this
Possible Duplicate: Javascript === vs == : Does it matter which “equal” operator I

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.