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
Get largest number from each sub-arrays
Image Rollover Using onMouseOver and onMouseOut
How to scroll page to 1000px from top on page load using jQuery?
Example to take user input and display on screen using JavaScript
How to current URL, HOST and URL attributes using JavaScript or jQuery?
How to the length of the longest word in the provided sentence?