最近面了linkedin前端电面2次,估计第一次第二个题讨论了太长时间没问完,基本都是面经题,不多说直接上题。口头问题:
coding:
- 看代码说结果,如何改正
var Foo = function( a ) {
function bar() {
return a;
}
this.baz = function() {
return a;
};
};
Foo.prototype = {
biz: function() {
return a;
}
};
var f = new Foo( 7 );
f.bar(); // error, undefined function
f.baz(); // 7
f.biz(); // undefined复制代码2. 给你一个有参数url:"linkedin.com?q1=v1&q2=v2” 写一个方返回{q1: ‘‘v1’’, q2: ‘‘v2’’}, 要用到decodeURL();3. 给个tooltip图片,照着写html, css - 用js拿第n个斐波拉契数1,1,2,3,5,8,13。。。第7个就是13,可以用top down的递归方法写,但是时间复杂度很高,用hash存子结果可以防止重复计算,但是会有格外空间消耗。用bottom up 迭代是最优解。
补充内容 (2017-9-24 09:02):
口头问题贴掉了:
- difference between GET and POST
- difference between Class inheritance and prototype inheritance
- difference between Promise and callback
列表条目