Missed function expression semicolon
Adding missed semicolon in function expression example.
This commit is contained in:
parent
4159a65ea2
commit
7371945a46
1 changed files with 1 additions and 1 deletions
|
@ -350,7 +350,7 @@ welcome(); // ok now
|
||||||
```smart header="When to choose Function Declaration versus Function Expression?"
|
```smart header="When to choose Function Declaration versus Function Expression?"
|
||||||
As a rule of thumb, when we need to declare a function, the first to consider is Function Declaration syntax. It gives more freedom in how to organize our code, because we can call such functions before they are declared.
|
As a rule of thumb, when we need to declare a function, the first to consider is Function Declaration syntax. It gives more freedom in how to organize our code, because we can call such functions before they are declared.
|
||||||
|
|
||||||
That's also better for readability, as it's easier to look up `function f(…) {…}` in the code than `let f = function(…) {…}`. Function Declarations are more "eye-catching".
|
That's also better for readability, as it's easier to look up `function f(…) {…}` in the code than `let f = function(…) {…};`. Function Declarations are more "eye-catching".
|
||||||
|
|
||||||
...But if a Function Declaration does not suit us for some reason, or we need a conditional declaration (we've just seen an example), then Function Expression should be used.
|
...But if a Function Declaration does not suit us for some reason, or we need a conditional declaration (we've just seen an example), then Function Expression should be used.
|
||||||
```
|
```
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue