Javascript考试 1. 姓名2. 根据下面的代码,选择代码输出的内容是哪个?var a = 2; foo(); function foo() { a = 3; console.log( a ); var a; } console.log( a );3,32,22,33,23. 根据下面的代码,选择代码输出的内容是哪个?function foo() { console.log( this.bar ); } var bar = "test"; foo(); new foo(); undefined,undefinedundefined,testtest,undefinedtest, test4. “5”+ 4 =?直接输出答案即可5. NaN*4 = ?直接输出答案即可6. null*4.5 = ?直接输出答案即可7. alert(5*1.015===5.075)truefalse8. 下面程序执行后弹出什么样的结果?function fn(){ this.a=0; this.b=function(){ alert(this.a); } } fn.prototype={ b:function(){ this.a=20; alert(this.a); }, c:function(){ this.a=30; alert(this.a); } } var myfn = new fn(); myfn.b(); myfn.c(); 20,300,3020,2030,300,209. NaN==NaN ?truefalse10. 以下哪条语句会产生运行错误A.var obj = ();B.var obj = [];C.var obj = {};D.var obj = //;11. 以下哪个单词不属于javascript保留字:A.withB.parentC.classD.void12. foo对象有att属性,那么获取att属性的值,以下哪些做法是可以的A.foo.attB.foo(“att”)C.foo[“att”]D.foo{“att”}E.foo[“a” ”t” ”t”]13. 以下输出的内容是?var fullname = ‘David Jones’ var obj ={ fullname: ‘Colin Brown’, prop:{ fullname:’Aurelio Deftch’, getFullname: function(){ return this.fullname; } } } var test = obj.prop.getFullname console.log(test()) obj.prop.getFullname() David Jones,Aurelio DeftchAurelio Deftch,Colin BrownAurelio Deftch, Aurelio DeftchDavid Jones,Colin Brown14. var x = 1 console.log( y) var y = 2直接写出答案15. null===undefined ==0truefalse16. 以下生成对象的方法中,正确的是 A. var z = new Boolean(a);B. var str = "JavaScript";C. fruit=new Array(3);D. today1=new Date(2008,10,1);E. today=new Date("October 1,2008");17. 关于JAVASCRIPT函数,下列说法正确的是A. 函数是独立于主程序的,具有特定功能的一段程序代码块B. 函数可以不用function关键字C. 函数的命名规则同变量命名规则是一样的D. 函数必须使用return语句E. 函数的调用时直接用函数名,并给形式参数赋值18. 分析下面的Javascript代码段,输出的内容是?function num(n){ if(n==1) return 1; return num(n-1)+n; } num(50);502500127510019. [typeof null, null instanceof Object]结果是?A. ["object", false]B. [null, false]C. ["object", true]D. other20. var val = 'smtg'; console.log('Value is ' + (val === 'smtg') ? 'Something' : 'Nothing');A. Value is SomethingB. Value is NothingC. NaND. other21. 输出结果是?var name = 'World!'; (function () { if (typeof name === 'undefined') { var name = 'Jack'; console.log('Goodbye ' + name); } else { console.log('Hello ' + name); } })(); A. Goodbye JackB. Hello JackC. Hello undefinedD. Hello World22. 结果是?var a = [0]; if ([0]) { console.log(a == true); } else { console.log("wut"); } A. trueB. falseC. "wut"D. other23. []==[]A. trueB. falseC. errorD. other24. [1 < 2 < 3, 3 < 2 < 1]A. [true, true]B. [true, false]C. errorD. other25. (function() { var x = y = 1; })(); console.log(y); console.log(x);A. 1, 1B. error, errorC. 1, errorD. other26. 输出是?var a = {}; var b = Object.prototype; [a.prototype === b, Object.getPrototypeOf(a) == b] A. [false, true]B. [true, true]C. [false, false]D. other 提交成功!
Javascript考试 1. 姓名2. 根据下面的代码,选择代码输出的内容是哪个?var a = 2; foo(); function foo() { a = 3; console.log( a ); var a; } console.log( a );3,32,22,33,23. 根据下面的代码,选择代码输出的内容是哪个?function foo() { console.log( this.bar ); } var bar = "test"; foo(); new foo(); undefined,undefinedundefined,testtest,undefinedtest, test4. “5”+ 4 =?直接输出答案即可5. NaN*4 = ?直接输出答案即可6. null*4.5 = ?直接输出答案即可7. alert(5*1.015===5.075)truefalse8. 下面程序执行后弹出什么样的结果?function fn(){ this.a=0; this.b=function(){ alert(this.a); } } fn.prototype={ b:function(){ this.a=20; alert(this.a); }, c:function(){ this.a=30; alert(this.a); } } var myfn = new fn(); myfn.b(); myfn.c(); 20,300,3020,2030,300,209. NaN==NaN ?truefalse10. 以下哪条语句会产生运行错误A.var obj = ();B.var obj = [];C.var obj = {};D.var obj = //;11. 以下哪个单词不属于javascript保留字:A.withB.parentC.classD.void12. foo对象有att属性,那么获取att属性的值,以下哪些做法是可以的A.foo.attB.foo(“att”)C.foo[“att”]D.foo{“att”}E.foo[“a” ”t” ”t”]13. 以下输出的内容是?var fullname = ‘David Jones’ var obj ={ fullname: ‘Colin Brown’, prop:{ fullname:’Aurelio Deftch’, getFullname: function(){ return this.fullname; } } } var test = obj.prop.getFullname console.log(test()) obj.prop.getFullname() David Jones,Aurelio DeftchAurelio Deftch,Colin BrownAurelio Deftch, Aurelio DeftchDavid Jones,Colin Brown14. var x = 1 console.log( y) var y = 2直接写出答案15. null===undefined ==0truefalse16. 以下生成对象的方法中,正确的是 A. var z = new Boolean(a);B. var str = "JavaScript";C. fruit=new Array(3);D. today1=new Date(2008,10,1);E. today=new Date("October 1,2008");17. 关于JAVASCRIPT函数,下列说法正确的是A. 函数是独立于主程序的,具有特定功能的一段程序代码块B. 函数可以不用function关键字C. 函数的命名规则同变量命名规则是一样的D. 函数必须使用return语句E. 函数的调用时直接用函数名,并给形式参数赋值18. 分析下面的Javascript代码段,输出的内容是?function num(n){ if(n==1) return 1; return num(n-1)+n; } num(50);502500127510019. [typeof null, null instanceof Object]结果是?A. ["object", false]B. [null, false]C. ["object", true]D. other20. var val = 'smtg'; console.log('Value is ' + (val === 'smtg') ? 'Something' : 'Nothing');A. Value is SomethingB. Value is NothingC. NaND. other21. 输出结果是?var name = 'World!'; (function () { if (typeof name === 'undefined') { var name = 'Jack'; console.log('Goodbye ' + name); } else { console.log('Hello ' + name); } })(); A. Goodbye JackB. Hello JackC. Hello undefinedD. Hello World22. 结果是?var a = [0]; if ([0]) { console.log(a == true); } else { console.log("wut"); } A. trueB. falseC. "wut"D. other23. []==[]A. trueB. falseC. errorD. other24. [1 < 2 < 3, 3 < 2 < 1]A. [true, true]B. [true, false]C. errorD. other25. (function() { var x = y = 1; })(); console.log(y); console.log(x);A. 1, 1B. error, errorC. 1, errorD. other26. 输出是?var a = {}; var b = Object.prototype; [a.prototype === b, Object.getPrototypeOf(a) == b] A. [false, true]B. [true, true]C. [false, false]D. other 提交成功!
2. 根据下面的代码,选择代码输出的内容是哪个?var a = 2; foo(); function foo() { a = 3; console.log( a ); var a; } console.log( a );3,32,22,33,2
3. 根据下面的代码,选择代码输出的内容是哪个?function foo() { console.log( this.bar ); } var bar = "test"; foo(); new foo(); undefined,undefinedundefined,testtest,undefinedtest, test
8. 下面程序执行后弹出什么样的结果?function fn(){ this.a=0; this.b=function(){ alert(this.a); } } fn.prototype={ b:function(){ this.a=20; alert(this.a); }, c:function(){ this.a=30; alert(this.a); } } var myfn = new fn(); myfn.b(); myfn.c(); 20,300,3020,2030,300,20
12. foo对象有att属性,那么获取att属性的值,以下哪些做法是可以的A.foo.attB.foo(“att”)C.foo[“att”]D.foo{“att”}E.foo[“a” ”t” ”t”]
13. 以下输出的内容是?var fullname = ‘David Jones’ var obj ={ fullname: ‘Colin Brown’, prop:{ fullname:’Aurelio Deftch’, getFullname: function(){ return this.fullname; } } } var test = obj.prop.getFullname console.log(test()) obj.prop.getFullname() David Jones,Aurelio DeftchAurelio Deftch,Colin BrownAurelio Deftch, Aurelio DeftchDavid Jones,Colin Brown
16. 以下生成对象的方法中,正确的是 A. var z = new Boolean(a);B. var str = "JavaScript";C. fruit=new Array(3);D. today1=new Date(2008,10,1);E. today=new Date("October 1,2008");
17. 关于JAVASCRIPT函数,下列说法正确的是A. 函数是独立于主程序的,具有特定功能的一段程序代码块B. 函数可以不用function关键字C. 函数的命名规则同变量命名规则是一样的D. 函数必须使用return语句E. 函数的调用时直接用函数名,并给形式参数赋值
18. 分析下面的Javascript代码段,输出的内容是?function num(n){ if(n==1) return 1; return num(n-1)+n; } num(50);5025001275100
19. [typeof null, null instanceof Object]结果是?A. ["object", false]B. [null, false]C. ["object", true]D. other
20. var val = 'smtg'; console.log('Value is ' + (val === 'smtg') ? 'Something' : 'Nothing');A. Value is SomethingB. Value is NothingC. NaND. other
21. 输出结果是?var name = 'World!'; (function () { if (typeof name === 'undefined') { var name = 'Jack'; console.log('Goodbye ' + name); } else { console.log('Hello ' + name); } })(); A. Goodbye JackB. Hello JackC. Hello undefinedD. Hello World
22. 结果是?var a = [0]; if ([0]) { console.log(a == true); } else { console.log("wut"); } A. trueB. falseC. "wut"D. other
25. (function() { var x = y = 1; })(); console.log(y); console.log(x);A. 1, 1B. error, errorC. 1, errorD. other
26. 输出是?var a = {}; var b = Object.prototype; [a.prototype === b, Object.getPrototypeOf(a) == b] A. [false, true]B. [true, true]C. [false, false]D. other