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
Write a function that splits an array into groups the length of size and returns them as a two-dimensional array
ES6 method of declaration multiple variables in one line
jQuery check if an element is visible or hidden
Generate random password for form field on click using JavaScript
JavaScript example to change image on click
How to current URL, HOST and URL attributes using JavaScript or jQuery?