From bb10764f9e0d27ad46134114738d8feb72f0aa3d Mon Sep 17 00:00:00 2001 From: Oliver Florentin Date: Thu, 7 Aug 2014 01:15:04 +0800 Subject: [PATCH] Fix first two code samples. 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 --- page/javascript-101/scope.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/page/javascript-101/scope.md b/page/javascript-101/scope.md index a7963964..7f4c23c8 100644 --- a/page/javascript-101/scope.md +++ b/page/javascript-101/scope.md @@ -29,6 +29,8 @@ function myFunc() { var x = 5; } +myFunc(); + console.log( x ); // ReferenceError: x is not defined ``` @@ -43,6 +45,8 @@ function myFunc() { x = 5; } +myFunc(); + console.log( x ); // 5 ```