On the problem of object assignment

topic description

about object assignment

sources of topics and their own ideas

Source interview questions

related codes

/ / Please paste the code text below (do not replace the code with pictures)

var o={};
     o.a=0; 
     var b=o; 
     b.a=10; 
     console.log(a);//a=0

what result do you expect? What is the error message actually seen?

an is an attribute of object o, so why can console.log (a) output 0? He is not a variable under window

Mar.28,2021

is there something wrong with this question?
output the sentence console.log (a); / / axi0 is the result of your test or is it wrong a undefined
logic of your question
this question should be based on the final output of console.log (o.a) / / 10

.
Menu