Skip to content

Instantly share code, notes, and snippets.

@andrijac
Created June 15, 2012 23:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrijac/2939164 to your computer and use it in GitHub Desktop.
Save andrijac/2939164 to your computer and use it in GitHub Desktop.
Scope
var wl = function(s) {
var dw = function(s){document.write(s);},
spaces = '       ';
dw(!s ? 'false!!!' : (s).toString());
dw(('<br />').toString());
for(var i in s) {
if((s[i]).toString().indexOf('function') !== -1) {
dw (spaces + i + ': ' + 'function');
} else {
dw (i + ': ' + s[i]);
}
dw (('<br />').toString());
}
};
var obj={};
obj.funk = function() {
var that = this;
var helper = function() {
that.value = 222;
};
helper();
};
wl(obj.value);
obj.funk();
wl(obj.value);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment