Traditional Culture Encyclopedia - Traditional stories - Syntax of ES6 arrow function and when not to use it.
Syntax of ES6 arrow function and when not to use it.
ES5:
Function f (a, b) {
Return a+b;
}
-& gt; ES6
Let f = (a, b) = > a + b
ES5:
Function f (a, b) {
Console.log ('Hello ES6.' );
Return a+b;
}
-& gt; ES6
Let f = (a, b) = > {
Console.log ('Hello ES6.' );
Return a+b;
}
If you write a function in a code block, if there is a return, you need to write your own return.
- Previous article:What the hell does monkey sent a funny man mean?
- Next article:The set for stage dispatch
- Related articles
- What are the effective methods of learning?
- How to write unforgettable traditional festival themes?
- Jiang Wei's life story
- Traditional manual five-kernel moon cake pastry method
- Radish giblet practice daquan
- Six schemes to ensure data consistency of distributed system
- I'm crazy about comedy" perfect finale to create a small weekend gold file
- What are the similarities between Chinese and English? What is the difference?
- Why do many teachers feel physically and mentally very tired?
- What kungfu does Jeet Kune Do include?