摘要: function fn1(){ console.log(this) } fn1();//window fn1.call({x:100});//{x:100} const fn2 = fn1.bind({x:200}) fn2();//{x:200} const zhangsan = { name:' 阅读全文
posted @ 2020-03-20 16:53 chenlw101 阅读(72) 评论(0) 推荐(0) 编辑
摘要: // 闭包:自由变量的查找,是在函数定义的地方,向上级作用域查找 , 不是在执行的地方!!! // 函数作为返回值 function create(){ let a =100; return function(){ console.log(a) } } const fn = create(); co 阅读全文
posted @ 2020-03-20 16:41 chenlw101 阅读(88) 评论(0) 推荐(0) 编辑