金三银四,跳槽旺季,而我也不例外,日前正在物色新工做。html
记得多少就分享多少,与你共勉。前端
经过正则去获取cookie对应key的值。node
function getValueByKey () {
let cookie = "age=12;id=123;name=jouryjc",
_reg = /(^|\s|;)id=([^;]*)(;|$)/
if (cookie.match(_reg)) {
console.log(cookie.match(_reg)[2]) #[";id=123;", ";", "123", ";", index: 6, input: "age=12;id=123;name=jouryjc"]
} else {
console.warn(`no match result`)
}
}
getValueByKey ()
复制代码
主要考察的是正则的应用。/(^|\s|;)id=([^;]*)(;|$)/,()表示匹配项,若是匹配到告终果,match第一项返回整个匹配结果,后面依次是每一个匹配项。不懂能够参考MDN。webpack
不定宽高的垂直水平居中(兼容IE6)git
跪了跪了,兼容IE6。知道的童鞋麻烦在评论区指导一下。es6
用原生JS写事件添加函数 function on(elem, type, handler),兼容IE8,并将handler函数的上下文绑定到事件对象上。github
function on(elem, type, handler) {
if (elem.addEventListener) {
elem.addEventListener(type, function () {
handler.bind(elem)
})
} else {
elem.attachEvent(type, function () {
handler.bind(elem)
})
}
}
复制代码
这道题相对基础。判断addEventListener和attachEvent(兼容IE8)就能够了。web
使用ES6语法实现类、静态属性、静态方法、私有方法、私有属性、继承面试
比较简单的一道题,考察ES6 class,忘了的童鞋赶忙补课吧。ajax
设计模式,写三个以上你熟悉的设计模式,而且尽量详细的描述。
工厂模式、单例模式、模块模式、代理模式、职责链模式、策略模式、中介者模式.....推荐一篇我的认为比较nice的设计模式详解
TCP三次握手图文详细描述
http/网络必考题,相信你们都懂的。
用node手写一个服务,并输出 hello, handsome boy!!!
const http = require('http');
const srv = http.createServer( (req, res) => {
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end('hello, handsome boy!!!');
});
复制代码
so easy!
实现两个超出(>Number.MAX_VALUE || < Number.MIN_VALUE)整数(含负数)相加函数function add(a, b)
没有写出来,本想顺着二进制(反码、补码等)作逻辑运算的思路去作,但无奈不少概念都忘了。bignumber.js,感兴趣童鞋能够去看看源码。
自我介绍都直接略过,直入项目: