当前位置:网站首页>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
边栏推荐
- Leetcode points to the leetcode road of offering II 091 house painting [dynamic planning] heroding
- acmStreamOpen返回值问题
- 【LeetCode】143. 重排链表
- Is opencv open source?
- Hello CTP (I) - basic knowledge of futures
- Windows 2003 64 bit system PHP running error: 1% is not a valid Win32 Application
- 【LeetCode】148. 排序链表
- How much do you know about the use value of WMS warehouse management system
- Development of trading system (VIII) -- Construction of low delay network
- "Grammar sugar" -- my new programming knowledge
猜你喜欢

numpy np tips:使用opencv对数组插值放缩到固定形状 cv2.resize(res, dsize=(64, 64), interpolation=cv2.INTER_CUBIC)
![L'épée leetcode fait référence au chemin leetcode de l'offre II 091 pour peindre la maison [planification dynamique] heroding](/img/ad/69fce7cf064479a0ddd477fb935de2.png)
L'épée leetcode fait référence au chemin leetcode de l'offre II 091 pour peindre la maison [planification dynamique] heroding

文本关键词提取:ansj

“语法糖”——我的编程新知

小心被偷脸!天天用的人脸识别风险原来这么多?

警惕超范围采集隐私-移动APP违规十宗罪

cesium 图形标注圆形、正方形、多边形、椭圆等

Development of trading system (III) - risk control system

Turn 2D photos into 3D models to see NVIDIA's new AI "magic"!

Cesium graphic annotation circle, square, polygon, ellipse, etc
随机推荐
IntStream API介绍
Laravel document sorting 2. Route related
PHP code audit 1 - php Ini
La gamme NFT Color, qui représente la diversité, est en ligne sur la plate - forme du marché Sandbox
Cesium 加载显示热力图
The 5th series of NFT works of missing parts was launched on the sandbox market platform
"Comment positionner l'industrie" dans la planification industrielle locale / parc
论文阅读《LSD-SLAM: Large-Scale Direct Monocular SLAM》
How to quickly deliver high-value software
Although the Internet in the traditional sense has long ceased to exist, this does not mean that the Internet has long disappeared
Nodejs 通过Heidisql连接mysql出现ER_BAD_DB_ERROR: Unknown database 'my_db_books'
Intel 13th generation core showed its true colors for the first time: 68mb cache improved significantly
numpy np tips:使用opencv对数组插值放缩到固定形状 cv2.resize(res, dsize=(64, 64), interpolation=cv2.INTER_CUBIC)
1280_ C language to find the average value of two unsigned integer
学习码 滚动码 固定码 有什么区别重码数,编码容量滚动码的原理
Laravel document sorting 11. System architecture
Numpy NP tips: use OpenCV to interpolate and zoom the array to a fixed shape cv2 resize(res, dsize=(64, 64), interpolation=cv2. INTER_ CUBIC)
Upgrade cmake
Turn 2D photos into 3D models to see NVIDIA's new AI "magic"!
Development of trading system (XIII) -- Analysis of quickfix source code