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)
項目流程篇
開放性問題