当前位置:网站首页>ES6箭头函数
ES6箭头函数
2022-06-30 05:58:00 【SignalFire】
1、this指向默认指向调用时的对象
箭头函数中的this指向定义时所在的对象
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<button id="btn">button</button>
</body>
<script>
let btn = document.querySelector("#btn");
btn.addEventListener('click',function(){
setTimeout(() => {
console.log(this);
},1000);
})
</script>
</html>
2、箭头函数不能作为构造函数使用
3、无法使用arguments对象,只能使用扩展运算符解析
let fn = (...args) => {
console.log(args);
}
fn(1,2,3,4,5);
边栏推荐
- Xijiao 21 autumn "motor and drive" online homework answer sheet (I) [standard answer]
- English语法_形容词/副词3级-最高级
- You don't know how to deduce the location where HashSet stores elements?
- Configure the user to log in to the device through telnet -- AAA local authentication
- Related applications of priority queue
- C语言基础小操作
- Use of OpenCL thread algebra library viennacl
- VLAN access mode
- 重构之美:当多线程批处理任务挑起大梁 - 万能脚手架
- MySQL index
猜你喜欢

Master slave synchronization of MySQL database to realize read-write separation

The average salary of software testing in 2022 has been released. Have you been averaged?

Gestion des utilisateurs de la base de données MySQL

Intelligent question - horse racing question

leetcode763. Divide letter interval
![[deep learning] data segmentation](/img/16/798881bbee66faa2fb8d9396155010.jpg)
[deep learning] data segmentation

Prototype and prototype chain in JS

C语言基础小操作

Zibll子比主题V6.4.1wordpress 开心版源码下载_破解原版/直接使用/无需教程

MySQL advanced (Advanced SQL statement)
随机推荐
How does WPS cancel automatic numbering? Four options
UE4_ Editor development: highlight the UI making method according to the assets dragged by the mouse (1)
Sword finger offer 18 Delete the node of the linked list
Summary of redis learning notes (I)
Solitidy - fallback 回退函数 - 2种触发执行方式
股票在网上开户安全吗?在网上能不能开户炒股呢?
Do you know how to show the health code in only 2 steps
【LeetCode】236. Nearest common ancestor of binary tree
24、 I / O device model (serial port / keyboard / disk / printer / bus / interrupt controller /dma and GPU)
How to automatically renew a token after it expires?
Lantern Festival | maoqiu technology and everyone "guess riddles and have a good night"
电脑查看WiFi使用密码
Promise knowledge points
I have been working as a software testing engineer for 5 years, but I was replaced by an intern. How can I improve myself?
Here comes the nearest chance to Ali
SHELL
After getting these performance test decomposition operations, your test path will be more smooth
拼多多店铺搜索相关问题,为什么新品上架搜索不到
Strlen and sizeof, array length and string length, don't be silly
[road of system analyst] collection of wrong topics in Project Management Chapter