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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T14:30:57+00:00 2026-06-05T14:30:57+00:00

I was thinking about declaring vars in JS, when a doubt arose. What’s the

  • 0

I was thinking about declaring vars in JS, when a doubt arose. What’s the priority of setting up two vars’ value at the same time? See:

var a = 1,
b = 1;

With this code, a is declared before b. But what about this code

var a = b = 1;

Which one does receive the value first? a or b?

  • 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-05T14:30:59+00:00Added an answer on June 5, 2026 at 2:30 pm

    It is evaluated as

    var a = (b = 1);
    

    Hence, b gets the value first.

    Note that this differs from the first snippet: If not already in global scope, b will become a global variable (if it was not declared before). This would cause an error in strict mode.

    A formal description can be found in the specification.

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

Sidebar

Related Questions

Thinking about avoiding code replication, I got a question that catches me every time
Today I was thinking about declaring this: private delegate double ChangeListAction(string param1, int number);
Thinking about if we modify the definition of Hamiltonian path as we need to
Been thinking about this for hours now. Im building a simple slideshow application, where
Just thinking about the best way to build an Order form that would (from
Im thinking about learn to develop app for iOS. I had a lot of
I was thinking about my code, and I accidentally clicked the Ln 74 at
I'm thinking about using the java application object to implement a simple cache, to
I've been thinking about the deployment process I am currently using, and I am
I'm thinking about throwing away my DB in my next project to simplify development/evolution.

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.