You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 1-js/06-advanced-functions/04-var/article.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,7 +52,7 @@ if (true) {
52
52
}
53
53
54
54
*!*
55
-
alert(test); //Error: test is not defined
55
+
alert(test); //ReferenceError: test is not defined
56
56
*/!*
57
57
```
58
58
@@ -82,7 +82,7 @@ function sayHi() {
82
82
}
83
83
84
84
sayHi();
85
-
alert(phrase); //Error: phrase is not defined
85
+
alert(phrase); //ReferenceError: phrase is not defined
86
86
```
87
87
88
88
As we can see, `var` pierces through `if`, `for` or other code blocks. That's because a long time ago in JavaScript, blocks had no Lexical Environments, and `var` is a remnant of that.
@@ -231,7 +231,7 @@ The Function Expression is wrapped with parenthesis `(function {...})`, because
231
231
232
232
```js run
233
233
// Tries to declare and immediately call a function
234
-
function() { // <-- Error: Function statements require a function name
234
+
function() { // <-- SyntaxError: Function statements require a function name
0 commit comments