1. 首页
  2. 数据库
  3. 其它
  4. javascript之this详解

javascript之this详解

上传者: 2021-01-16 21:02:52上传 PDF文件 26.62KB 热度 19次
this关键字 每个函数都有一个关键字叫this,在不同的情况下,this代表的内容也是不同的 1. 普通函数中的this代表window对象 function fn(){ console.log(this); } fn(); // window 2.定时器中的this代表window对象 let obj={ run:()=>{ setTimeout(()=>console.log(this)) } } obj.run();//window 3.自调用函数中的this代表window对象 function fn(
下载地址
用户评论