1 <script> 2 // 定义一个方法 3 const person= { 4 getInfo() { 5 console.log(this); 6 }, 7 }; 8 // 把方法拿出来,定义一个顶级变量 9 const getInfo= person.getInfo; 10 11 person.getInfo();// 调用者:person,this:person 12 getInfo();// 调用者:window,this:window 13 script>
Copyright © 2009-2022 www.kswsj.com 成都快上网科技有限公司 版权所有 蜀ICP备19037934号