Skip to content

Instantly share code, notes, and snippets.

@andrewjmead
Created April 10, 2016 14:05
Show Gist options
  • Save andrewjmead/432e9c6c5e973be502488d6ad6f85403 to your computer and use it in GitHub Desktop.
Save andrewjmead/432e9c6c5e973be502488d6ad6f85403 to your computer and use it in GitHub Desktop.
Auchomag - Variables
// EXAMPLE ONE
var foo = 'Andrew';
console.log(foo); // 'Andrew'
function foo () {
return 'From foo function'
}
console.log(foo()); // 'From foo function'
// At this point we have no way to access the foo variable 'Andrew'
// EXAMPLE TWO
var bar = 'Mike';
var obj = {
bar: function () {
return 'From bar function'
}
};
// Here we have access to both bar and obj.bar()
@auchomage
Copy link

Thanks for taking the time to do this, I see what you mean, even though I don't understand the reason why. It has helped.

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