How do you know where to exactly pull properties from objects after a new evaluation of object literal?











up vote
-3
down vote

favorite












everyone! I'm having an issue understanding this program:






var zomB = {
name: "Zom B.",
peepsEaten: 5
},
zomA = zomB,
oldHome = "Atlanta",
newHome = oldHome;
zomA.name = "Zom A.";
//outputs ZomA
console.log(zomB.name);





I'm confused as to why ZomA outputted by the zomB.name. Can someone please explain this?










share|improve this question









New contributor




Newbie Coder is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • The output I get is Zom A.. You may have made a typo. If so please fix your question
    – smac89
    Nov 18 at 2:40








  • 3




    Possible duplicate of Is JavaScript a pass-by-reference or pass-by-value language?
    – connexo
    Nov 18 at 2:42










  • In JS, objects (alongside 'special' objects like functions and arrays) are passed by reference , whereas primitives (like Strings, Number and Boolean) are passed by value .
    – connexo
    Nov 18 at 2:43












  • Possible duplicate of Pass-by-reference JavaScript objects
    – Randy Casburn
    Nov 18 at 2:44










  • I don't understand why you are confused about. Can you please explain what you are confused about and what your expected output is?
    – NewToJS
    Nov 18 at 2:49















up vote
-3
down vote

favorite












everyone! I'm having an issue understanding this program:






var zomB = {
name: "Zom B.",
peepsEaten: 5
},
zomA = zomB,
oldHome = "Atlanta",
newHome = oldHome;
zomA.name = "Zom A.";
//outputs ZomA
console.log(zomB.name);





I'm confused as to why ZomA outputted by the zomB.name. Can someone please explain this?










share|improve this question









New contributor




Newbie Coder is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • The output I get is Zom A.. You may have made a typo. If so please fix your question
    – smac89
    Nov 18 at 2:40








  • 3




    Possible duplicate of Is JavaScript a pass-by-reference or pass-by-value language?
    – connexo
    Nov 18 at 2:42










  • In JS, objects (alongside 'special' objects like functions and arrays) are passed by reference , whereas primitives (like Strings, Number and Boolean) are passed by value .
    – connexo
    Nov 18 at 2:43












  • Possible duplicate of Pass-by-reference JavaScript objects
    – Randy Casburn
    Nov 18 at 2:44










  • I don't understand why you are confused about. Can you please explain what you are confused about and what your expected output is?
    – NewToJS
    Nov 18 at 2:49













up vote
-3
down vote

favorite









up vote
-3
down vote

favorite











everyone! I'm having an issue understanding this program:






var zomB = {
name: "Zom B.",
peepsEaten: 5
},
zomA = zomB,
oldHome = "Atlanta",
newHome = oldHome;
zomA.name = "Zom A.";
//outputs ZomA
console.log(zomB.name);





I'm confused as to why ZomA outputted by the zomB.name. Can someone please explain this?










share|improve this question









New contributor




Newbie Coder is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











everyone! I'm having an issue understanding this program:






var zomB = {
name: "Zom B.",
peepsEaten: 5
},
zomA = zomB,
oldHome = "Atlanta",
newHome = oldHome;
zomA.name = "Zom A.";
//outputs ZomA
console.log(zomB.name);





I'm confused as to why ZomA outputted by the zomB.name. Can someone please explain this?






var zomB = {
name: "Zom B.",
peepsEaten: 5
},
zomA = zomB,
oldHome = "Atlanta",
newHome = oldHome;
zomA.name = "Zom A.";
//outputs ZomA
console.log(zomB.name);





var zomB = {
name: "Zom B.",
peepsEaten: 5
},
zomA = zomB,
oldHome = "Atlanta",
newHome = oldHome;
zomA.name = "Zom A.";
//outputs ZomA
console.log(zomB.name);






javascript arrays object






share|improve this question









New contributor




Newbie Coder is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Newbie Coder is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited Nov 18 at 2:43









NewToJS

2,3413819




2,3413819






New contributor




Newbie Coder is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Nov 18 at 2:37









Newbie Coder

1




1




New contributor




Newbie Coder is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Newbie Coder is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Newbie Coder is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • The output I get is Zom A.. You may have made a typo. If so please fix your question
    – smac89
    Nov 18 at 2:40








  • 3




    Possible duplicate of Is JavaScript a pass-by-reference or pass-by-value language?
    – connexo
    Nov 18 at 2:42










  • In JS, objects (alongside 'special' objects like functions and arrays) are passed by reference , whereas primitives (like Strings, Number and Boolean) are passed by value .
    – connexo
    Nov 18 at 2:43












  • Possible duplicate of Pass-by-reference JavaScript objects
    – Randy Casburn
    Nov 18 at 2:44










  • I don't understand why you are confused about. Can you please explain what you are confused about and what your expected output is?
    – NewToJS
    Nov 18 at 2:49


















  • The output I get is Zom A.. You may have made a typo. If so please fix your question
    – smac89
    Nov 18 at 2:40








  • 3




    Possible duplicate of Is JavaScript a pass-by-reference or pass-by-value language?
    – connexo
    Nov 18 at 2:42










  • In JS, objects (alongside 'special' objects like functions and arrays) are passed by reference , whereas primitives (like Strings, Number and Boolean) are passed by value .
    – connexo
    Nov 18 at 2:43












  • Possible duplicate of Pass-by-reference JavaScript objects
    – Randy Casburn
    Nov 18 at 2:44










  • I don't understand why you are confused about. Can you please explain what you are confused about and what your expected output is?
    – NewToJS
    Nov 18 at 2:49
















The output I get is Zom A.. You may have made a typo. If so please fix your question
– smac89
Nov 18 at 2:40






The output I get is Zom A.. You may have made a typo. If so please fix your question
– smac89
Nov 18 at 2:40






3




3




Possible duplicate of Is JavaScript a pass-by-reference or pass-by-value language?
– connexo
Nov 18 at 2:42




Possible duplicate of Is JavaScript a pass-by-reference or pass-by-value language?
– connexo
Nov 18 at 2:42












In JS, objects (alongside 'special' objects like functions and arrays) are passed by reference , whereas primitives (like Strings, Number and Boolean) are passed by value .
– connexo
Nov 18 at 2:43






In JS, objects (alongside 'special' objects like functions and arrays) are passed by reference , whereas primitives (like Strings, Number and Boolean) are passed by value .
– connexo
Nov 18 at 2:43














Possible duplicate of Pass-by-reference JavaScript objects
– Randy Casburn
Nov 18 at 2:44




Possible duplicate of Pass-by-reference JavaScript objects
– Randy Casburn
Nov 18 at 2:44












I don't understand why you are confused about. Can you please explain what you are confused about and what your expected output is?
– NewToJS
Nov 18 at 2:49




I don't understand why you are confused about. Can you please explain what you are confused about and what your expected output is?
– NewToJS
Nov 18 at 2:49

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});






Newbie Coder is a new contributor. Be nice, and check out our Code of Conduct.










 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53357401%2fhow-do-you-know-where-to-exactly-pull-properties-from-objects-after-a-new-evalua%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes








Newbie Coder is a new contributor. Be nice, and check out our Code of Conduct.










 

draft saved


draft discarded


















Newbie Coder is a new contributor. Be nice, and check out our Code of Conduct.













Newbie Coder is a new contributor. Be nice, and check out our Code of Conduct.












Newbie Coder is a new contributor. Be nice, and check out our Code of Conduct.















 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53357401%2fhow-do-you-know-where-to-exactly-pull-properties-from-objects-after-a-new-evalua%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Costa Masnaga

Fotorealismo

Sidney Franklin