面试题总结

230 阅读1分钟
英语流利说 - 2019.03
1.数组去重?
var arr1 = [2,3,3,4,5,2,8,9,2];
var arr2 = [{a:1},{a:2},{a:3},{a:1},{a:2},{a:3}];
2.this 指向?
var a = {
  b: function(){
    console.log(this)
  }
};
var c = a.b;
a.b();
c();
3.浏览器事件模型?冒泡与捕获顺序?
4.async/await 内部实现? async 返回什么?
5.varletconst ? 变量提升?块级作用域?临时性死区?
6.Webpack 用过哪些 loader 与 plugin?
7.HTTP 2.0 v.s. HTTP 1.x ?
8.HTTPS 如何实现加密?
9.垂直居中的实现?
10.Vue 如何实现数据响应式?
11何种方式了解新技术?

------------------------------------------------------------------------------------------------------------

字节跳动 - 2019.03
什么是跨域?如何解决?反向代理为什么能实现跨域?
如何使用原型 prototype 实现继承?
实现一个函数,使 son 能够继承 father,包括 father 自身的属性?
function inherit(son, father) {}
以下代码输出什么?
console.log('1');

setTimeout(function () {
 console.log('2');
}, 100);

console.log('3');

async function test() {
 console.log('4');
 await Promise.resolve();
 console.log('5');
}

test();

var a = new Promise(function (resolve) {
 setTimeout(() => {
  resolve();
  console.log('6');
 });
});

console.log('7');

a.then(function () {
 console.log('8');
});
请实现如下的函数,可以批量请求数据,所有的 URL 地址在 urls 参数中,同时可以通过 max 参数控制请求的并发度,当所有请求结束之后,需要执行 callback 回调函数。发请求的函数可以直接使用 fetch 即可。
function sendRequet(urls: string[], max: number, callback: () => void){}
6、甲乙轮流抛硬币,谁先抛到正面谁赢,问甲先抛硬币,赢得概率是多少?

二  阅