声明一个对象,给它加上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);}};
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);}};
举一反三
- 声明一个对象,给它加上name属性和show方法显示其name值,以下代码中正确的是
- 创建一个对象obj,该对象包含一个名为"name"的属性,其值为"value"。以下哪一段JavaScript代码无法得到上述的结果?() A: var obj=newObject();obj["name"]="value"; B: varobj=newObject();obj.prototype.name="value"; C: varobj={name:"value"}; D: varobj=newfunction(){this.name="value";}
- 以下关于字符串变量的声明不正确的是? A: var myText = "my name is zhangsan"; B: var myText = 'my name is zhangsan'; C: var myText = 'my name is zhangsan"; D: var myText = "my name is\t zhangsan";
- 下列描述中,()不是方法重载。 A: void Show(){}和void Show(string name){} B: string Show(string name){}和void Show(string name){} C: string Show(int age){}和void Show(string name){} D: void Show(int age){}和void Show(int age,string name){}
- 你想在根目录下查找一个名zhangsan的文件时,你使用下面的哪个命令? A: find / -name zhangsan B: find / zhangsan C: find zhangsan -name / D: find where name zhangsan