面经

2019-04-18  本文已影响0人  Gaarahan

记录面试中遇到的常见问题,待完善

原型链继承


class继承

class Han extends Gaara{
    constructor(name,data,age){
        this.age = age;
    }
}
var a = new Han('Gaarahan',2,21); 
//  Must call super constructor in derived class before accessing 'this' or returning from derived constructor
// 在访问this和从衍生类之前,必须调用super构造函数
class Han extends Gaara{
    constructor(name,data,age){
        this.age = age;
      super(name,data);
    }
}
var a = new Han('Gaarahan',2,21);  // 与上面报错相同
class A {
  constructor(){
    this.name = 'han';
  }
  han(){
    console.log(this.name);
  }
}
class B extends A{
  name = 'gaara';
  show(){
    super.han();
  }
}
var x = new B();
x.show(); // 'gaara'  调用时this指向x
class A{}
class B extends A{}
B.__proto__ === A //表示B继承自A
B.prototype.__proto__ === A.prototype // 表示B的原型继承自A的原型
// 继承包括构造函数(实例属性)的继承,和原型对象(原型属性)的继承
A.__proto__ === Function.prototype // A未指定继承,因此作为函数默认继承了Function.prototype
A.prototype.__proto__ === Object.prototype // A调用后会返回一个空对象

promise


Array新增方法

Array.from(obj,mapCallBack) // 将类数组对象和可遍历对象转化为数组
Array.of(a,b,c,...)  // 将一组值转化为数组,弥补Array构造函数的不足(无参,一个,三个参数时,行为有差异)
find(func) findIndex(func)  // 找出数组中第一个满足该func的值,并返回该值/下标
fill(val,start,end)  // 使用val填充数组,可指定开始和结束位置
entries(),keys(),values() // 返回数组的 键值对/键/值
includes()    // 数组是否包含元素
flat(count) flatMap()  // 拉平数组count层,对每个成员执行map,并拉平一层

http状态码


三次握手,四次挥手


vue 双向绑定的实现

let a = {};
Object.defineProperty(a,'x',{
  set(value){
    console.log('u have spy by me');
    x = value;
  },
  get(){
    return x;
  }
});
a.x = 1; // 输出 u have spy by me

mvc mvp mvvm


冒泡和捕获


JWT


移动端页面中图片加载较慢时,如何保持页面的布局


http协议由几部分组成


cookie存放在http协议的哪个位置


设计模式


浏览器流程

  1. DNS解析 -> 建立TCP连接 -> 发送请求 -> 服务器处理请求 -> 解析返回的数据渲染成页面展示 -> 断开连接

http 与 https


常见的请求响应头

  1. 请求头:
  1. 响应头:

Vue生命周期

上一篇 下一篇

猜你喜欢

热点阅读