Skip to content

Instantly share code, notes, and snippets.

@xandkar
Created July 22, 2016 17:27
Show Gist options
  • Save xandkar/6355b32bf9f5ea42353191d856cde41f to your computer and use it in GitHub Desktop.
Save xandkar/6355b32bf9f5ea42353191d856cde41f to your computer and use it in GitHub Desktop.
#! /usr/bin/env node
var foo = function() {
console.log("foo's x: %s BEFORE IT ENTERS SCOPE", x);
x = "xb";
y = "ya";
return 0
}
var main = function() {
x = "xa";
console.log("main's x1: %s", x);
foo();
console.log("main's x2: %s", x);
console.log("main's y: %s, WHICH IT HAS NEVER SEEN BEFORE", y);
}
main()
@xandkar
Copy link
Author

xandkar commented Jul 22, 2016

@rehia @AeroNotix: Yep. See the gist about loops, which includes output of versions with and without "use strict": https://gist.github.com/xandkar/9a422ea5cf01408a9d67fa4800e53b25

:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment