Skip to content

Instantly share code, notes, and snippets.

@navanathjadhav
Created June 17, 2022 13:47
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 navanathjadhav/62cfd62d709068de01cce7cdd7acca9c to your computer and use it in GitHub Desktop.
Save navanathjadhav/62cfd62d709068de01cce7cdd7acca9c to your computer and use it in GitHub Desktop.
Example of Global variables
/*
* This will be hoisted as a global variable
*/
function Greet() {
message = "Hello & Welcome to Ever Blogs";
}
/*
* This will also become a global variable as global functions have
* global `this` as the contextual `this` in non strict mode
*/
function Greet() {
this.message = "Hello & Welcome to Ever Blogs";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment