Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Question: Explain Global Variables in Javascript.
Answer: Global variables are those declared outside of functions
Global variables are ‘visible’ from anywhere in the program, including inside functions

var globalHello = “Hello!”;

function writeHello() {
document.write(globalHello);
}
// outputs “Hello!”
Is it helpful? Yes No

Most helpful rated by users:

©2025 WithoutBook