首页 > 网站 > WEB开发 > 正文

这些javascript面试题,你做对了几道?

2024-04-27 14:16:51
字体:
来源:转载
供稿:网友

这些javascript面试题,你做对了几道?

1.----------------------------------------------------

var fun = function(){this.name = 'peter';return {name: 'jack'};}var p = new fun();

请问p.name是:

a:'peter', b:'jack', c:null, d:undefined

2.----------------------------------------------------

var fun = function(){this.name = 'peter';return 'jack';    }var p = new fun();

请问p.name是:

a:'peter', b:'jack', c:null, d:undefined

3.----------------------------------------------------

var fun = function(){}fun.PRototype = {info : {name : 'peter',age : 25}}var a = new fun();var b = new fun();a.info.name = 'jack';b.info.name = 'tom';

请问a.info.name和b.info.name分别是:

a:'jack', 'tom', b:'jack', 'jack', c:'tom','tom', d:'tom', 'jack'

4.----------------------------------------------------

var fun = function(){this.info = {name : 'peter',age : 25}}var a = new fun();var b = new fun();a.info.name = 'jack';b.info.name = 'tom';

请问a.info.name和b.info.name分别是:

a:'jack', 'tom', b:'jack', 'jack', c:'tom','tom', d:'tom', 'jack', e:其它

5.----------------------------------------------------

var fun = function(){}fun.prototype = {    name : 'peter',    age : 25    }var a = new fun();var b = new fun();a.name = 'jack';b.name = 'tom';

请问a.name和b.name分别是:

a:'jack', 'tom', b:'jack', 'jack', c:'tom','tom', d:'tom', 'jack', e:其它

6.----------------------------------------------------

var fun = function(){this.info = {name : 'peter',age : 25}}fun.prototype = {info : {name : 'peter',age : 25}}var a = new fun();var b = new fun();a.info.name = 'jack';b.info.name = 'tom';

请问a.info.name和b.info.name分别是:

a:'jack', 'tom', b:'jack', 'jack', c:'tom','tom', d:'tom', 'jack'


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表