以前在 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
}复制代码