How to define Global Variable in JavaScript?

No special keyword will be required to define variable as Global. Variables declared globally have a global scope, they known throughout the application, from the start of the application.
<!DOCTYPE html>
<html>
<body>
<div id="test"></div>
<script>
//global variable
var a = 100;

globalFunc();

function globalFunc(){
	document.getElementById("test").innerHTML = a;
}
</script>

</body>
</html>
Most Helpful This Week