nazerke
4/20/2016 - 5:13 AM

global variable can be accessed through window.global_var

global variable can be accessed through window.global_var

var b = "this is global var";

function z(){
var v = "this is not global var";
c = "this too is a global var";
}

// b in window -> true   window.b -> "this is global var"
// c in window -> false  window.c -> undefined
// v in window -> false  window.v -> undefined