Menu

2021年4月发表的所有文章

Typescript 中的 interface 和 type 区别

interface 和 type在官方规范中所描述的区别: An interface can be named in an extends or implements clause, but a type alias for an object type literal cannot. An interface can have multiple merged declarations, but a type alias for an object type literal cannot. 翻译如下: 接口可以在extends或im...

js经典易错合集(一)

1.函数的this指向 var length = 10 function fn(){ console.log(this.length) } fn() //10 //函数的this指向调用者,这里调用者为window //var声明的变量会挂载到window上 var obj={ length:2, show:function(f){ this.length=5 f() arguments[0]() }, show2:(f)=>{ this...