当前位置:网站首页>JS arrow function
JS arrow function
2022-06-25 04:24:00 【Robin Luo Bing】
The syntax of arrow function expression is more concise than function expression , And there's no one of its own this,arguments,super or new.target. Arrow function expressions are more suitable for places where anonymous functions are needed , And it cannot be used as a constructor .
1、 Basic grammar
(param1, param2, …, paramN) => { statements }
(param1, param2, …, paramN) => expression
// amount to :(param1, param2, …, paramN) =>{ return expression; }
// When there is only one parameter , Parentheses are optional :
(singleParam) => { statements }
singleParam => { statements }
// Functions without arguments should be written as a pair of parentheses .
() => { statements }2、 Advanced Grammar
// The bracketed function body returns the object literal expression :
params => ({foo: bar})
// The remaining parameters and default parameters are supported
(param1, param2, ...rest) => { statements }
(param1 = defaultValue1, param2, …, paramN = defaultValueN) => {
statements }
// Parameter list deconstruction is also supported
let f = ([a, b] = [1, 2], {x: c} = {x: a + b}) => a + b + c;
f(); // 6
边栏推荐
- Laravel document sorting 7. View
- Lecture record: data processing methods and applications of various spatial geodetic techniques
- Development of trading system (II) -- market data
- 文本关键词提取:ansj
- Laravel document sorting 1. Installation and Preliminary Configuration
- Cesium drag 3D model
- Error 1062 is reported during MySQL insertion, but I do not have this field.
- Numpy NP tips: squeeze and other processing of numpy arrays
- How much do you know about the use value of WMS warehouse management system
- L'épée leetcode fait référence au chemin leetcode de l'offre II 091 pour peindre la maison [planification dynamique] heroding
猜你喜欢

Development of trading system (VI) -- HFT high frequency trading

Coinlist queuing tutorial to improve the winning rate

Acmstreamopen return value problem

Watch out for the stolen face! So many risks of face recognition used every day?

"Renaissance" in the digital age? The bottom digital collection makes people happy and sad

Where is the red area of OpenCV?

讲座记录《多种空间大地测量技术的数据处理方法和应用》

Lecture record: history and development of strapdown inertial navigation solution

NFT Insider #63:The Sandbox与时代杂志达成合作,YGG成立西班牙subDAO

How much do you know about the use value of WMS warehouse management system
随机推荐
acmStreamOpen返回值问题
Development of trading system (XII) - Official quickfix document
Mathematical analysis_ Notes_ Chapter 3: limits
小心被偷脸!天天用的人脸识别风险原来这么多?
代錶多樣性的彩色 NFT 系列上線 The Sandbox 市場平臺
Nodejs 通过Heidisql连接mysql出现ER_BAD_DB_ERROR: Unknown database 'my_db_books'
A-table mouse over the display hand, the current line can be clicked
1.初识半音阶口琴
虽然传统意义上的互联网早已不复存在,但这并不代表互联网早已消失不再
client-go gin的简单整合十一-Delete
Cesium 拖拽3D模型
【Proteus仿真】Arduino UNO按键控制数码管闪烁增/减显示
openmmlab-环境配置
Hello CTP (III) - CTP quotation API
95% 程序员都在这里摸鱼……
IntStream API介绍
【LeetCode】22. 括号生成
Development of trading system (II) -- market data
[kubernetes series] installation and use of Helm
Flutter Builder & futurebuilder components