注意:此页面搜索的是所有试题
声明一个对象,给它加上name属性和show方法显示其name值,以下代码中正确 的是( )。(本题2.0分)
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);}};

参考答案