今天来简单学习一下JavaScript中的this关键字。 (注:所有代码均在"strict mode"环境下运行) 1.全局作用域 console.log(this); //global scope 输出结果为Window对象 2.函数表达式 const calcAge=function (birthYear){ console.log(2037-birthYear); console.log(this);
专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]
Copyright (C)ICode9.com, All Rights Reserved.
ICode9版权所有