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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:52:28+00:00 2026-06-06T14:52:28+00:00

Is there a name for this? Here’s an example of what I’m trying to

  • 0

Is there a name for this? Here’s an example of what I’m trying to say:

var i = 0;
var j = 0;
i = j = 1;

So obviously both i and j are set to 1. But is there a name for this practice? Also, in terms of good coding standards, is this type of thing generally avoided? Can I also get an example or explanation of why it is/isn’t good practice?

  • 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-06T14:52:29+00:00Added an answer on June 6, 2026 at 2:52 pm

    As Daniel said, it’s called chained assignment. It’s generally avoided, because for some values (such as objects), the line i = j = _something_ creates a reference from i to j. If you later change j, then i also changes.

    var i = {};
    var j = {};
    i = j = {a:2};
    j.a = 3; //Now, j.a === 3 AND i.a === 3
    

    See this jsFiddle demo for an example: http://jsfiddle.net/jackwanders/a2XJw/1/

    If you don’t know what i and j are going to be, you could run into problems

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

Sidebar

Related Questions

There is struct like this. struct Address { int id; int set; char name[MAX_DATA];
I call this a flash meeting, but maybe there is another more appropriate name.
I've seen this questions here . I'm wondering if there exists an official name
Also, Is there a proper name for this strip? Is there any documentation on
I'm trying to imitate this example: http://jqueryui.com/autocomplete/#multiple-remote Here's are two of the target elements:
How is this possible, what is going on there? Is there a name for
Is there a way to get the exact name of the object that this
I'm just curious, but is there a name for the process using print statements
This is what I'm trying to achieve. Here is an existing piece of code
There was an answer similar to this here: How to pass a function as

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.