Skip to content

Instantly share code, notes, and snippets.

@navanathjadhav
Created June 17, 2022 13:51
Embed
What would you like to do?
Example of Avoiding global varibales
"use strict";
/*
* This will not be hoisted as global variable
*/
function Greet() {
message = "Hello & Welcome to Ever Blogs"; // It will throw run time error
}
/*
* This will not become global variable as global functions
* have their own `this` in 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