注意:此页面搜索的是所有试题
声明一个对象,包含name属性和show()方法,以下代码中正确的是( )。
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);}};

参考答案