Web_Design 板


LINE

※ 引述《WJames (星晨)》之铭言: : 这不是作业,也不是 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') ) C 这题要先从 statement 的反面下手 不等於 改成 等於 且 改成 或 用中文解释的话就是 ua不是IE6且ua不是IE7 的反面是 ua是IE6或ua是IE7 最後再否定他 就是否定的否定=肯定 这个好像叫做 迪摩根定理 : 2. Which is false ? : A) 1 == '1' : B) NaN == NaN : C) 1 == [1]+[] : D) undefind === undefined B 老梗题目了... 不过这题的 C 我还是搞不懂怎麽解释他 : 3. Which is true ? : A) 1=== true : B) Number('1px') : C) typrof [1,2,3] == 'array' : D) '0' D 在判断真假的时候 字串会被转为ascii字码 '0'会被转换成30 大於0所以为真 : 4. What is b : : var a = [ 1, 2, 3 ]; : var b = a; : a.push(5); : console.log(b) [1,2,3,5] object 与 array 都是传址 array 可以呼叫 .slice(0) 进行复制 object 要透过回圈 : 5. Please answer below two "this"? : $('#foo').on('click', function(e){ : console.log( this ); //What is this ? native DOM node #foo : setTimeout( function(){ : console.log( this ); //What is this ? 全域物件window : }, 1000} : }) 这题要讲解有点困难... 可以跳过吗QQ? http://rettamkrad.blogspot.tw/2012/11/how-this-works-in-javascript.html : 6. How can get the 'hello': : var obj = { 1: 'hello', 2: 'world'} : A) obj.1 : B) obj[0] : C) obj[1] : D) obj.2 C 这题应该不用说明吧 A 与 D 会发生例外 syntax error: unexpected number : 7.Please answer all below typeof: : typeof function(){} 'function' : typeof new Date() 'object' : typeof {} 'object' : typeof new Array() 'object' 我的记法是除了基本资料型态以外都是回传 'object' function 会回传 'function' 还有个例外是 undefined 会回传 'undefined' 但是 null 会回传 'object' 是个很大的陷阱 不亚於 array 回传 'object' : 8.What do you think foo() is ? : if(1) function foo(){ return 'a'} : else function foo(){ return 'b'} : console.log( foo() ) 'b' function declaration vs expression http://tinyurl.com/34b4udr http://tinyurl.com/kzs7yd9 : 9.What is the console.log output? : function foo(){ : return this; : } : console.log( foo.call( foo ) ) function foo() { 略 } http://dreamerslab.com/blog/tw/javascript-call-and-apply/ : 10.Please explain what is the difference between "setTimeout()" and : "setInterval()" ? 一个是只执行一次 另一个是重复执行 : 11.Please explain what the use of "preventDefault()" and ""stopPropagation()" : in Event Object ? preventDefault 是取消 event 的预设行为 像是对 <a> click 会造成换页、<input type="submit">会送出表单之类 stopPropagation()是阻止事件向更上层的元素传播 像是巢状的 div 标签 <div id="first"> <div id="second"> <div id="third">Click me!</div> </div> </div> 对 div#third, #second, #first 监听 click 事件 并在 #second 的 handler 使用 event.stopPropagation() 的话 就不会触发 #first 的 click 事件 http://jsfiddle.net/KwtP7/ : 以上 就这几题 : 至於是哪家公司的面试题目 我就不透漏了,透露出来好像不太好 --
1F:推 jumbotest:反正操你妹应该只是基本作 她开心就好 01/21 15:40
2F:→ jumbotest: 操01/21 15:40
3F:→ jumbotest:我没有骂脏话01/21 15:44
--



※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 59.127.251.59
4F:推 WJames:感谢推...但是蛮想听听第五题的讲解的...QQ 06/13 01:48
5F:→ WJames:或是有推荐什麽参考资料吗? 我自己看 06/13 01:49
补上参考连结: http://rettamkrad.blogspot.tw/2012/11/how-this-works-in-javascript.html ※ 编辑: s25g5d4 来自: 59.127.251.59 (06/13 02:25) ※ 编辑: s25g5d4 来自: 59.127.251.59 (06/13 02:47)
6F:推 rettamkrad:object(array)遇到+号都是先转成字串,所以变成'1'+'' 06/13 18:58
7F:推 applexva:推 06/15 10:11







like.gif 您可能会有兴趣的文章
icon.png[问题/行为] 猫晚上进房间会不会有憋尿问题
icon.pngRe: [闲聊] 选了错误的女孩成为魔法少女 XDDDDDDDDDD
icon.png[正妹] 瑞典 一张
icon.png[心得] EMS高领长版毛衣.墨小楼MC1002
icon.png[分享] 丹龙隔热纸GE55+33+22
icon.png[问题] 清洗洗衣机
icon.png[寻物] 窗台下的空间
icon.png[闲聊] 双极の女神1 木魔爵
icon.png[售车] 新竹 1997 march 1297cc 白色 四门
icon.png[讨论] 能从照片感受到摄影者心情吗
icon.png[狂贺] 贺贺贺贺 贺!岛村卯月!总选举NO.1
icon.png[难过] 羡慕白皮肤的女生
icon.png阅读文章
icon.png[黑特]
icon.png[问题] SBK S1安装於安全帽位置
icon.png[分享] 旧woo100绝版开箱!!
icon.pngRe: [无言] 关於小包卫生纸
icon.png[开箱] E5-2683V3 RX480Strix 快睿C1 简单测试
icon.png[心得] 苍の海贼龙 地狱 执行者16PT
icon.png[售车] 1999年Virage iO 1.8EXi
icon.png[心得] 挑战33 LV10 狮子座pt solo
icon.png[闲聊] 手把手教你不被桶之新手主购教学
icon.png[分享] Civic Type R 量产版官方照无预警流出
icon.png[售车] Golf 4 2.0 银色 自排
icon.png[出售] Graco提篮汽座(有底座)2000元诚可议
icon.png[问题] 请问补牙材质掉了还能再补吗?(台中半年内
icon.png[问题] 44th 单曲 生写竟然都给重复的啊啊!
icon.png[心得] 华南红卡/icash 核卡
icon.png[问题] 拔牙矫正这样正常吗
icon.png[赠送] 老莫高业 初业 102年版
icon.png[情报] 三大行动支付 本季掀战火
icon.png[宝宝] 博客来Amos水蜡笔5/1特价五折
icon.pngRe: [心得] 新鲜人一些面试分享
icon.png[心得] 苍の海贼龙 地狱 麒麟25PT
icon.pngRe: [闲聊] (君の名は。雷慎入) 君名二创漫画翻译
icon.pngRe: [闲聊] OGN中场影片:失踪人口局 (英文字幕)
icon.png[问题] 台湾大哥大4G讯号差
icon.png[出售] [全国]全新千寻侘草LED灯, 水草

请输入看板名称,例如:Soft_Job 或 站内搜寻

TOP