Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
How to define global variable in a JavaScript function?
To declare a global variable, use the var at global scope −
<script>
var myGlobalVariable;
function display() {
//
}
</script>
For JavaScript function, assign the property to a window −
<script>
function display() {
window. myGlobalVariable = …;
}
</script> Advertisements
