作者WJames (星晨)
看板Web_Design
标题[讨论] Javascript 一些问题
时间Wed Jun 12 19:26:59 2013
这不是作业,也不是 take home exam。
这是小弟在应徵工作时碰到的 JS考题。
免试早已经结束,只是当时有用手机将考题拍下来。
想说有机会可以上来跟强者讨论讨论,很想知道正确解答,
跟我的作答差距多少,由於公司也没告诉我正确答案(笔试),试卷他们收走
我也不好意思问,就post在版上,让各位前辈强者有兴趣的话回答一下罗。
也算是分享应徵考试的经验给大家。
1. which is equl to the condition
if( ua !== 'IE 6'&& ua != 'IE 7')
A) if( ua === 'IE 6' || ua === 'IE 7')
B) if( ua === 'IE 6' && ua === 'IE 7')
C) if( !( ua === 'IE 6'|| ua === 'IE 7') )
D) if( !( ua === 'IE 6'&& ua === 'IE 7') )
2. Which is false ?
A) 1 == '1'
B) NaN == NaN
C) 1 == [1]+[]
D) undefind === undefined
3. Which is true ?
A) 1=== true
B) Number('1px')
C) typrof [1,2,3] == 'array'
D) '0'
4. What is b :
var a = [ 1, 2, 3 ];
var b = a;
a.push(5);
console.log(b)
5. Please answer below two "this"?
$('#foo').on('click', function(e){
console.log( this ); //What is this ?
setTimeout( function(){
console.log( this ); //What is this ?
}, 1000}
})
6. How can get the 'hello':
var obj = { 1: 'hello', 2: 'world'}
A) obj.1
B) obj[0]
C) obj[1]
D) obj.2
7.Please answer all below typeof:
typeof function(){}
typeof new Date()
typeof {}
typeof new Array()
8.What do you think foo() is ?
if(1) function foo(){ return 'a'}
else function foo(){ return 'b'}
console.log( foo() )
9.What is the console.log output?
function foo(){
return this;
}
console.log( foo.call( foo ) )
10.Please explain what is the difference between "setTimeout()" and
"setInterval()" ?
11.Please explain what the use of "preventDefault()" and ""stopPropagation()"
in Event Object ?
以上 就这几题
至於是哪家公司的面试题目 我就不透漏了,透露出来好像不太好
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 220.136.44.140
※ 编辑: WJames 来自: 220.136.44.140 (06/12 19:28)
1F:推 matrixki:其实去面试过的都知道是哪家 XDD 06/12 23:44