声明一个对象,给它加上 name 属性和 show 方法显示其 name 值,以下代码中正确的是()
A.var obj = [name:"zhangsan",show:function(){alert(name);}]; B.var obj = ,name:"zhangsan",show:”alert(this.name)”-; C.var obj = {name:"zhangsan",show:function(){alert(name);}}; D.var obj = {name:"zhangsan",show:function(){alert(this.name);}};正确答案D