In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you whether the arrow function is a new function of es6, I hope you will gain something after reading this article, let's discuss it together!
The arrow function is a new feature of es6; the arrow function is a new function in es6 that allows you to define functions using the arrow "= >". It supports expressions and statement bodies relative to ordinary functions, and the arrow function has the same scope as the code around this.
This tutorial operating environment: windows10 system, ECMAScript version 6. 0, Dell G3 computer.
Is the Arrow function a New feature of es6?
A new function has been added to the ES6 standard: Arrow Function (Arrow function), which allows you to define functions using the arrow = >.
Compared with ordinary functions, it is syntactically similar to the related functions in Java 8, supporting expressions and statement bodies.
Unlike ordinary functions, arrow functions have the same scope as the code around this. The arrow function has the following characteristics:
1. You don't need the function keyword to create a function.
2. Omit the return keyword.
3. This always points to the this value under the scope when the function is declared (that is, the arrow function does not have its own this at all, but refers to the outer this).
Use the ES6 arrow function syntax to define the function, delete the "function" keyword and function name of the original function, and use "= >" to connect the parameter list and the function body.
The function of arrowhead function
/ / 1. Make the expression more concise const isEven = n = > n% 2 = = 0% Const square = n = > n * n; / / 2, simplify callback function / / ordinary function writing [1line 2mag3] .map (function (x) {return x * x;}); / / arrowhead function writing [1ZO2CH3] .map (x = > x * x)
Es5 is written:
Arrow function:
After reading this article, I believe you have a certain understanding of "Arrow function is a new function of es6". If you want to know more about it, welcome to follow the industry information channel. Thank you for your reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 221
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.