function setName(obj) { obj.name = "tgcoy"; obj = new Object(); obj.name = "tg"; } var person = new Object(); setName(person); alert(person.name);
上述JS的结果是:tgcoy