Skip to content

Instantly share code, notes, and snippets.

@lenafaure
Created April 30, 2017 08:32
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 lenafaure/76dc9c48a67cecbb4db24b30a40f438c to your computer and use it in GitHub Desktop.
Save lenafaure/76dc9c48a67cecbb4db24b30a40f438c to your computer and use it in GitHub Desktop.
Access global scope from inside a function
var greeting = "Hi there!"; // global scope
function sayHello() {
console.log(greeting);
}
sayHello(); // Prints "Hi there !"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment