一些关于js的小问题-数据类型&原型-4-6

*测试

这些小题可能并不像你看到的那么简单,相信会对你更深刻的理解js有所帮助 题目为本人原创,支持转载,但请注明出处this

1.var a=new Number(10);var b=10;如下代码和返回值不匹配的是

A typeof a;//Number
B typeof b;//numberprototype

C a instanceof Number//true原型

D b instanceof Number//falseio

2.function A(a){var b = 'b';return a(a);}console.log(A(function(){return this;}))运行结果是啥

A "a"console

B "b"function

C A{}co

D window{}new

3.a=2;function fn(a){a=a+2}fn(a);alert(a);结果是

A "a"return

B 2

C 4

D "undefined"

4.(1)var a;console.log(typeof a==undefined);(2)var a;console.log(typeof a===undefined)

A (1)flase (2)true

B (1)true (2)true

C (1)true (2)false

D (1)false (2)false

5.var a={};function fn(a){a={b:2}};fn(a);alert(a.b)

A 报错"b is not defind"

B 2

C undefined

D 报错'b is not a propty of null'

6.下列关于原型说法测试代码返回false的是正确的是

A function fn(){};console.log(fn.__proto__==Object.prototype)

B console.log(Function.__proto__.__proto__==Object.prototype)

C console.log(Object.__proto__==Function.prototype)

D console.log(fn.__proto__==Function.prototype)

A D B D C A

相关文章
相关标签/搜索