【文件属性】:
文件名称:this-in-[removed]:Japanese_symbol_for_beginner:学习JavaScript中“ this”的概念! -[五个概念]
文件大小:2KB
文件格式:ZIP
更新时间:2021-04-26 23:00:08
的概念this在JavaScript
TL; DR
如果一个函数被调用使用new关键字, this将是生成的对象。
如果一个函数被调用, .call() .apply()或.bind() this将是在传递的对象。
如果一个函数被调用的对象上, obj.foo() this将是它被称为上的对象。
如果一个函数自己说sayMyName() , this它将是undefined (如果use strict;模式)或全局对象(如果是非严格模式)。
概念#1
如果一个函数被调用使用new关键字, this将是生成的对象。
let myName = new String ( 'Ahmad Awais' ) ;
typeOf ( myName ) ; // object <================== this is the resulting object.
概念#2
如果一个
【文件预览】:
this-in-JavaScript-master
----README.md(6KB)