Skip to content

Commit 2b38106

Browse files
redbagmovingRedWolves
authored andcommitted
javascript-101/scope.md: Fix first two code samples.
Closes jquerygh-545 The original sample below will really give out a Reference Error since the function wasn't called in the first place. function myFunc() { x = 5; } console.log( x ); // 5
1 parent 8527fbe commit 2b38106

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

page/javascript-101/scope.md

+4
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ function myFunc() {
2828
var x = 5;
2929
}
3030
31+
myFunc();
32+
3133
console.log( x ); // ReferenceError: x is not defined
3234
```
3335

@@ -42,6 +44,8 @@ function myFunc() {
4244
x = 5;
4345
}
4446
47+
myFunc();
48+
4549
console.log( x ); // 5
4650
```
4751

0 commit comments

Comments
 (0)