以前在 segmentfault.com/a/119000001… 看到過這篇文章,最近閒下來就作着玩了一下, 若有誤,還請斧正css
1.瀏覽器工做原理 html
2.Web安全,舉例說明前端
5.對象繼承 nginx
Child.prototype = new Parent();複製代碼
Child.prototype = Parent.prototype;
Child.prototype.constructor = Child;複製代碼
6.ES6歷史以及新特性有哪些?web
8.事件模型面試
div.onclick = fn()
addEventListener(eventType, handler, useCapture)
attachEvent( "eventType","handler")
9.常見兼容性問題,列舉(移動端/PC端)sql
騰訊二面(機試)
相似百度搜索的提示框,兼容各大瀏覽器,可用鍵盤控制.
勉強憋了出來,可是掛掉了,犯了一些低級錯誤,顯示經驗不足.
面試官建議多看書,多寫組件.json
function ReverseList(pHead) {
var pre = null;
var next = null;
while (pHead != null) {
next = pHead.next;
pHead.next = pre;
pre = pHead;
pHead = next;
}
return pre;
}複製代碼
2.快排segmentfault
const quickSort = (arr) => {
if(arr.length < 1) return arr;
let inx = Math.floor(arr.length/2);
let pivot = arr.splice(inx,1)[0];
let left = [];
let right = [];
for(let i=0; i<arr.length; i++){
if(arr[i] < pivot){
left.push(arr[i])
}else{
right.push(arr[i])
}
}
return quickSort(left).concat(pivot,quickSort(right))
}複製代碼
proxy_cookie_domain localhost example.org;
proxy_cookie_domain ~\.([a-z]+\.[a-z]+)$ $1;
proxy_cookie_path /one/ /;
proxy_cookie_path / /two/;複製代碼
一面(記錄兩個,其餘都還好)後端
設計模式(要求說出如何實現,應用,優缺點):
單例模式
實現:
const createMask = ()=>{
let mask = null;
return ()=> mask || document.appendChild(document.createElement('div'))
}
const mask = createMask();複製代碼
const Example = function(name,age){
this.name = name || 'Tom',
this.age = age || '18'
this.say = function(){
console.log(`name:${this.name},age:${this.age}`)
}
}複製代碼
發佈訂閱模式
實現:
const Example = {};
Example.clientList = [];
Example.listen = function(fn){
this.clientList.push(fn)
}
Example.trigger = function(){
for(let i=0,fn; fn=this.clientList[i++]){
fn.apply(this,arguments)
}
}
Example.listen(function(message){
console.log(message) // 我發佈了一個消息,此時訂閱者會收到消息
})
Example.trigger(function(){
console.log('我發佈了一個消息,此時訂閱者會收到消息')
})複製代碼
location / {
proxy_pass xxx
}複製代碼