[英]what is the difference between assigning one object to another object and returning object and assigning it to another object in javaScript?
so if we create two object 所以如果我们创建两个对象
var dog = {
var name:"dog",
makeSound: function(){
alert("wow");
}
}
var cate = {
var name:"cate",
makeSound: function(){
alert("meow");
}
}
cate = dog;
now both cate
and dog
point to same object. 现在,
cate
和dog
指向同一个对象。
and if we do it like this 如果我们这样做
cate = object.create(dog);
what is the difference between the two is cate
and dog
point to same object now? cate
和dog
指向同一对象的区别是什么?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.