作者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)
推 matrixki:其實去面試過的都知道是哪家 XDD 06/12 23:44