bookmark_borderHow to access global variable in JavaScript

Accessing global variable in JavaScript, what is global variable where it used.
Global variable is accessible everywhere in the script, for example if you want to access variable which defined in top.

<script language="javascript">
// declaring global variable 
var myVariable = 1;

Its accessible inside the function or outside the function as variable.
there is a method call window.variable which will be same as calling the variable inside the function.

Continue reading “How to access global variable in JavaScript”