当前位置:网站首页>ES6_ Arrow function
ES6_ Arrow function
2022-07-07 08:28:00 【bdundun】
The arrow function doesn't prototype attribute , You can't use it new and arguments.
Arrow functions are not bound this keyword , In the arrow function this Points to the context where the arrow function defines the position this.
<script>
function Fn(){
console.log(this);
return ()=>{
console.log(this);
}
}
obj={
'name':'zhangsan'}
ret=Fn.call(obj);// Returns the arrow function
ret();// Call arrow function
/* Although the arrow function is called outside , however this No window, It is the context in which the arrow function defines the position this.*/
</script>
<script>
var obj={
age:20,
say:()=>{
alert(this.age)
}
}
obj.say();// Output undefined. Because objects cannot generate scopes , So the arrow function is defined under the global scope ,this Point to window.
</script>
边栏推荐
- 解析创新教育体系中的创客教育
- Explore creativity in steam art design
- 在Rainbond中一键部署高可用 EMQX 集群
- opencv学习笔记四——膨胀/腐蚀/开运算/闭运算
- Opencv learning notes 1 -- several methods of reading images
- SSM 整合
- In go language, function is a type
- Pvtv2--pyramid vision transformer V2 learning notes
- 使用 Nocalhost 开发 Rainbond 上的微服务应用
- Rainbow combines neuvector to practice container safety management
猜你喜欢
Splunk中single value视图使用将数值替换为文字
发挥创客教育空间的广泛实用性
Splunk query CSV lookup table data dynamic query
Coquette data completes the cloud native transformation through rainbow to realize offline continuous delivery to customers
Openvscode cloud ide joins rainbow integrated development system
Learn how to compile basic components of rainbow from the source code
Rainbow 5.7.1 supports docking with multiple public clouds and clusters for abnormal alarms
eBPF Cilium实战(1) - 基于团队的网络隔离
Implement your own dataset using bisenet
[paper reading] icml2020: can autonomous vehicles identify, recover from, and adapt to distribution shifts?
随机推荐
2-3查找树
Interpreting the practical application of maker thinking and mathematics curriculum
Lua 编程学习笔记
提高企业产品交付效率系列(1)—— 企业应用一键安装和升级
CTF-WEB shrine模板注入nmap的基本使用
藏书馆App基于Rainbond实现云原生DevOps的实践
Coquette data completes the cloud native transformation through rainbow to realize offline continuous delivery to customers
机器人教育在动手实践中的真理
Opencv learning note 5 - gradient calculation / edge detection
Caractéristiques de bisenet
Kotlin combines flatmap for filtering and zip merge operators
Lua programming learning notes
grpc、oauth2、openssl、双向认证、单向认证等专栏文章目录
Golang compilation constraint / conditional compilation (/ / +build < tags>)
Explore creativity in steam art design
Pvtv2--pyramid vision transformer V2 learning notes
Offer harvester: add and sum two long string numbers (classic interview algorithm question)
2-3 lookup tree
[quick start of Digital IC Verification] 13. SystemVerilog interface and program learning
DeiT学习笔记