找考题网-背景图
单项选择题

A.varobj=[name: zhangsan ,show:function(){alert(name);}……

声明一个对象,给它加上name属性和show方法显示其name值,以下代码中正确的是()。

A.varobj=[name:"zhangsan",show:function(){alert(name);}];
B.varobj={name:"zhangsan",show:”alert(this.name)”};
C.varobj={name:"zhangsan",show:function(){alert(name);}};
D.varobj={name:"zhangsan",show:function(){alert(this.name);}};