黄瓜的不定期更新面试题

1    http和https的区别

  1、https协议需要到ca申请证书,http不需要

  2、http是超文本传输协议,https则是具有安全性的ssl加密传输协议。

  3、http和https使用的是完全不同的连接方式,用的端口也不一样,前者是80,后者是443

  4、http的连接很简单,是无状态的;

    HTTPS协议是由SSL+HTTP协议构建的可进行加密传输、身份认证的网络协议,比http协议安全。

2   使用原生实现forEach

Array.prototype.forEach=function(fn){
    for(let i=0;i<this.length;i++){ 
        fn.call(this,this[i],i,this)
    }
}


var a=[1,2,3]
a.forEach((el,index,arr)=>{
    console.log(el,index,arr)
})

猜你喜欢

转载自www.cnblogs.com/huang-gua123/p/12088347.html