摘要:
1、工厂模式 function playerFactory (username){ var user= new object (); user .username = username; return user ; } var zs = playerFactory( 'zhangsan ') 优点: 阅读全文
摘要:
1、this默认绑定 this默认绑定即函数调用时,无论函数声明在哪,在哪调用,由于函数调用时无任何调用前缀的情景,默认绑定时this指向全局对象(非严格模式): function fn1() { let fn2 = function () { console.log(this); //window 阅读全文