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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:27:06+00:00 2026-06-18T02:27:06+00:00

suppose i have this var x={}; //x is an address in the memory where

  • 0

suppose i have this

var x={};    //x is an address in the memory where object is stored
var z=x;     //z=x after execution is equal to z={} right?

now z has nothing to do with x or not related to x after execution so when,

x={name:"Maizere"};
z!=x        //true

but, when

x.name="maizere";
alert(z.name)//maizere why?

we are not setting the value of z but x and z relation to x shouldn’t exit anymore

actual code:

 x={};
 y=x;
 x.name="maizere";
 alert(y.name)//maizere

I really have no knowledge of how this is working .Can anyone explain this in detail please?

  • 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-18T02:27:07+00:00Added an answer on June 18, 2026 at 2:27 am

    Your initial assumption is wrong; z is a pointer to the same object as x.

    var x = {}; 
    var z = x;
    
    alert( z === x );    // true
    

    When you do x = { name: "Maizere" }; you’re assigning a new object to x. z is still pointing to the original object.

    x = { name: "Maizere" };
    alert( z !== x );    // true
    

    In the latter example you’re not creating a new object but changing the original object’s property.

    var x = {}; 
    var z = x;
    
    x.name = "maizere";
    alert( z === x );    // true
    

    A further example of where the confusion might stem from: the bracket syntax creates a new object instead of modifying the original.

    var x = { name: "Maizere" };
    var y = { name: "Zaimere" };
    
    x = { age: 20 };
    y.age = 30;
    
    console.log( x );  // {age: 20}                  <-- original object is replaced
    console.log( y );  // {name: "Zaimere", age: 30} <-- original object is modified
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have this code: var myArray = new Object(); myArray["firstname"] = "Bob"; myArray["lastname"]
Suppose I have this jQuery code. $(document).delegate('a[title]', 'click', function(event) { var txt = //
Suppose I have this class: class MyClass(object): def uiFunc(self, MainWindow): self.attr1 = foo self.attr2
Suppose I have this feature branch foo. Now I want to merge it back
suppose I have this query : int[] Numbers= new int[5]{5,2,3,4,5}; var query = from
In javascript suppose you have this piece of code: <div> <script type=text/javascript>var output =
Suppose I have a list of strings, like this: var candidates = new List<String>
Let's suppose I have a schema like this: var Person = new Schema({ name:
Suppose I have this code: static void Main(string[] args) { var thread = new
Suppose I have an array of objects like this: var nodes = [{size:8,name:myName},{size:10,name:otherName},{size:11,name:userName}]; How

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.