Your bullet point 2 is generally how folks write functions if they are not using shorthand. That is why my blog post starts with the example of an arrow function that has {} and return.
The shorthand is omitting the braces and return when there is one expression, Which is reflected by the fourth bullet point (or the part you just quoted). So at this point I am covering both the points you mentioned.
I do consider both examples as edge cases but they are correct and valid. I have updated the article to showcase them. I appreciate the feedback.
Thanks for reading! ♥️
"Hello World!" is not a statement, and if it were, it would not return.
It is an expression, and it evaluates.
Yep agreed. Corrected the post as I mentioned above.
Looking better, although
If it has {} or return, then the function body isn't an expression. :)
I think the simplest way to express it is that there are two distinct forms.
Your bullet point 2 is generally how folks write functions if they are not using shorthand. That is why my blog post starts with the example of an arrow function that has {} and return.
The shorthand is omitting the braces and return when there is one expression, Which is reflected by the fourth bullet point (or the part you just quoted). So at this point I am covering both the points you mentioned.
Thanks for the feedback.
Sure. The main thing is not to conflate expressions and statements. :)