当前位置:网站首页>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>
边栏推荐
- 在Rainbond中实现数据库结构自动化升级
- 打通法律服务群众“最后一公里”,方正璞华劳动人事法律自助咨询服务平台频获“点赞”
- 漏洞复现-easy_tornado
- [untitled]
- Four items that should be included in the management system of integral mall
- Give full play to the wide practicality of maker education space
- 一文了解如何源码编译Rainbond基础组件
- Thirteen forms of lambda in kotlin
- Understanding of out covariance, in inversion and invariance in kotlin
- Application of slip ring of shipborne radar antenna
猜你喜欢
PVTV2--Pyramid Vision TransformerV2学习笔记
轻松上手Fluentd,结合 Rainbond 插件市场,日志收集更快捷
[untitled]
BiSeNet的特點
Openvscode cloud ide joins rainbow integrated development system
One click installation of highly available Nacos clusters in rainbow
2-3 lookup tree
打通法律服务群众“最后一公里”,方正璞华劳动人事法律自助咨询服务平台频获“点赞”
rsync远程同步
CCTV is so warm-hearted that it teaches you to write HR's favorite resume hand in hand
随机推荐
藏书馆App基于Rainbond实现云原生DevOps的实践
Golang 编译约束/条件编译 ( // +build <tags> )
一种适用于应用频繁测试下快速查看Pod的日志的方法(grep awk xargs kuberctl)
Low success rate of unit test report
Ebpf cilium practice (1) - team based network isolation
opencv学习笔记一——读取图像的几种方法
如何理解分布式架构和微服务架构呢
下载和安装orcale database11.2.0.4
Tuowei information uses the cloud native landing practice of rainbow
Transformation function map and flatmap in kotlin
发挥创客教育空间的广泛实用性
[IELTS speaking] Anna's oral learning records part2
POJ - 3784 Running Median(对顶堆)
opencv学习笔记二——图像基本操作
opencv学习笔记三——图像平滑/去噪处理
Iptables' state module (FTP service exercise)
Snyk dependency security vulnerability scanning tool
Splunk子查询模糊匹配csv中字段值为*
Understanding of out covariance, in inversion and invariance in kotlin
One click deployment of highly available emqx clusters in rainbow