From 02ea95377d4963c60a96976b4092bdcc2b638594 Mon Sep 17 00:00:00 2001 From: Adam Brenecki Date: Wed, 14 Aug 2013 17:20:34 +0930 Subject: Avoid telling people about techniques that are discouraged anyway --- javascript.html.markdown | 6 ------ 1 file changed, 6 deletions(-) (limited to 'javascript.html.markdown') diff --git a/javascript.html.markdown b/javascript.html.markdown index 865edc36..1f188832 100644 --- a/javascript.html.markdown +++ b/javascript.html.markdown @@ -252,15 +252,9 @@ i // = 5 - not undefined as you'd expect in a block-scoped language // in a web browser is always 'window'. The global object may have a // different name in non-browser environments such as Node.js. window.permanent = 10 - // Or, as previously mentioned, if you leave the var keyword off, a - // global variable will be created when you assign it a value. However, - // this behavior is frowned upon, and in fact is disallowed in "strict - // mode". - permanent2 = 15 })() temporary // raises ReferenceError permanent // = 10 -permanent2 // = 15 <-- the accidental global variable // One of JavaScript's most powerful features is closures. If a function is // defined inside another function, the inner function has access to all the -- cgit v1.2.3