2020从我第一份简历投递出去已经将近两个月了,虽然暂时没画句号,但我想先记录一下,大家裸面的,裸辞的都慎重一下。javascript
下面写的都是真实面试过的,真的会考的。包括腾讯,阿里,头条,滴滴,美团,好将来,真融宝,快手,贝壳等,对问的题目进行了分类。css
题主中途也心理崩溃过,好在有靠谱领导和小伙伴分析,靠谱老公支持,最终抗到了如今。html
平常问题前端
html篇vue
css篇java
js基础篇node
理解事件循环机制(会问你详细怎么走的,必须得无理解了才能彻底hold住);async与await是什么任务;为何是微任务jquery
示例题1 console.log('script start'); setTimeout(function() { console.log('setTimeout'); }, 0); Promise.resolve().then(function() { console.log('promise1'); }).then(function() { console.log('promise2'); }); console.log('script end');
示例2:输出什么,为何?webpack
示例3 async function async1(){ console.log('async1 start') await async2() console.log('async1 end')//w1 } async function async2(){ console.log('async2') } console.log('script start') setTimeout(function(){// h1 console.log('setTimeout') },0) async1(); new Promise(function(resolve){ console.log('promise1') resolve(); }).then(function(){ console.log('promise2')//w2 }) console.log('script end')
示例4任务队列理解 setTimeout(()=>{ console.log(1); Promise.resolve().then(()=>{ console.log(2); }); }, 0) setTimeout(()=>{ console.log(3); Promise.resolve().then(()=>{ console.log(4); }); }, 0)
写一个正则匹配/<script/>内的内容 const str = /<script\>....</script> /<div\></div> \<label text="aa"/></label>
判断下面的对象是如何成环的 var a = { b: c } var c = { d: d } var d = { a: a }
ES6篇es6
promise结合try catch
try{ Promise.reject(2) .catch((e)=>{ console.log(e) throw new Error(3) }) }catch(e){ console.log(e) } try{ const data = await Promise.reject(2); console.log(data); console.log(4); throw new Error(3); }catch(e){ console.log(e)
function 和尖头函数的区别
m:function(){ console.log(this) }, n:()=>{console.log(this)} }; a.m(); a.n(); var x=a.m; var y=a.n; function f(){ x(); y(); } x(); y();
解构
const obj = { a: { b:1, }, c:2 } const obj1 = {...obj}; const obj2 = {...obj1}; obj.a.b = 3; obj.c = 4; obj1.a.b
Vue篇
vue.nextTick(()=>{})是怎么实现的,以及下面的输出
data: { a: 1 } vue.nextTick(()=>{ this.a = 2 console.log(this.a) }) Promise.resolve().then(()=>{ this.a = 3; }) console.log(this.a)
webpack篇
npm篇
http篇
移动端
性能优化篇
服务端篇
手写代码和算法篇
请用js实现将一个二维数组转换成树结构 例如:将下面数据 [ ["a", "aa", "aaa", "aaaa"], ["b", "bb", "bbb"], ["a", "ab", "aba"], ["a", "aa", "aab"] ] 转为: [ { "name" : "a", "child" : [ { "name" : "aa", "child" : [ { "name" : "aaa", "child" : [ { "name" : "aaaa", "child" : [] } ] }, { "name" : "aab", "child" : [] } ] }, { "name" : "ab", "child" : [ { "name": "aba", "child" : [] } ] } ] }, { "name": "b", "child" : [ { "name" : "bb", "child" : [ { "name" : "bbb", "child" : [] } ] } ] }
`fn = f(n-1) + f(n-2) f0 = 0 f1 = 1 n >=0 正整数 fn`
嵌套数组拍平
[1,2,3,4,[5,6,[7]],8] [1,2,3,4,5,6,7,8] 除了常规方法,还有奇葩方法,全转字符串再把中括号删掉
query解析
?a=0&a=1&a=2&c&url=url内容#333 转成 { query:{ a:[0,1,2], url:'url内容' }, hash:''
手写
var data = { a: { b: { c: 'ScriptOJ' } } } console.log(safeGet(data, 'a.b.c')) // => scriptoj console.log(safeGet(data, 'a.b.c.d')) // => 返回 undefined console.log(safeGet(data, 'a.b.c.d.e.f.g')) // => 返回 undefined console.log('ScriptOJ') // => 打印 ScriptOJ
函数柯里化
请实现方法`curry(Function) => Function`,传入一个多参函数,返回单参函数 example: const sub = function(a, b, c, d) { return a+b+c+d; } const subCurry = curry(sub); sub(1,2,3,4) = subCurry(1)(2)(3)(4) sub(1,2,3,4) = subCurry(1,2)(3)(4)
项目流程篇
开放性问题