Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Commit de8d155

Browse files
committed
Merge pull request #86 from mobify/function-expression-hoisting
Fix the point about function expression hoisting
2 parents 0812ad7 + 9708e40 commit de8d155

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

javascript/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ a = b;
109109

110110
The function expression is clearly recognisable as what it really is (a variable with a function value). Additionally, it helps organize code so that all variable declarations appear at the top of a file, and invocations follow. This gives some predictablity when others are reading your code, allowing for a more consistent structure.
111111

112-
Function expressions are subject to [hoisting](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/var#var_hoisting), and as such declaring functions as expressions will result in their being hoisted to the top of their enclosing function or global code.
112+
Function expressions are not subject to [hoisting](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function#Function_declaration_hoisting). This encourages developers to declare functions before invoking them.
113113

114114

115115
````javascript

0 commit comments

Comments
 (0)