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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T20:55:44+00:00 2026-06-03T20:55:44+00:00

I know in javascript x = y = z means x = z and

  • 0

I know in javascript

x = y = z means x = z and y = z

x+=z means x=x+z;

So if I want x=x+z and y=y+z, I tried x+=y+=z not working

anyone have a better idea to write short code instead x+=z;y+=z

EDIT

First thanks for everyone involved in my question.
Here I wanna explain something why I have this question in first place.

I tried to write some code like x+='some html code', and I need to y+='the same html code'. So naturally I do not want to create another var z='the html code first then do x+=z and y+=z

Hope my explain make sense. Anyway, I am going to close this question now. Thanks again.

  • 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-03T20:55:46+00:00Added an answer on June 3, 2026 at 8:55 pm

    Assuming addition, and not concatenation, this works:

    x -= y - (y += z);
    

    but seriously, don’t use it !


    For those that want to figure out how, the sequence of evaluation (where I use n to show the current intermediate result) is approximately:

    n = y1 = y0 + z  //    n = y = (y + z)
    n = y0 - y1      // -> n == -z  [uses the original value of y]
    x -= n           // -> x += z
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As we all know Javascript is a client side language , means code runs
I do not know javascript right now but I am planning on learning it.
I know zero javascript, and have one simple task: Find all text in the
I know that javascript doesn't have pointers in terms of a variable referring to
does anyone know of a (relatively) recent matrix which describes which handsets support javascript
I want to know is it possible to call a php function within javascript,
I know that IE does not support pushState, but I want a way for
I have a web app that is completely contolled with javascript. This means there
I have 3 sets of tabular data I want to display with a JavaScript
I am playing a little with some non-blocking JavaScript loading. This means I have

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.