When should you use return statement in ES6 arrow functions?
P粉771233336
2023-08-22 13:20:02
<p>The new ES6 arrow functions say that in some cases, <code>return</code> is implicit: </p>
<blockquote>
<p>This expression is also the implicit return value of the function. </p>
</blockquote>
<p>In what situations do I need to use <code>return</code> in an ES6 arrow function? </p>
I understand this rule of thumb...
The candidates are:
For other operations (if multiple lines of code are required, an explicit return value is required)
Jackson partially answered this question in a similar question:
I would like to add the definition of block:
Example: