diff --git a/app.js b/app.js index c1c82aa..12e7f3d 100644 --- a/app.js +++ b/app.js @@ -1,9 +1,5 @@ -function greeting() { - let message = 'Hello'; - let sayHi = function hi() { - let message = 'Hi'; - }; - sayHi(); - console.log(message); // Hello as 'Hi' is out of scope +let message = 'Hello'; +if (message === 'Hello') { + var count = 100; // var is within global scope, when it's not within object or function } -greeting(); \ No newline at end of file +console.log(count); // No reference error, which is dangerous \ No newline at end of file