What is the difference between local and global variables?

Local variables are defined within a subroutine. Their scope/visibility ends when the cursor leaves the subroutine.
Global variables on the other hand are variables that exist outside of all the subroutines and functions, and are available to all of them.

CD

Related Computing A Level answers

All answers ▸

Explain why it is important to check the email address with JavaScript and again when it reaches the server.


Describe a queue data structure.


What is the difference between HTML, CSS and JavaScript


State the main features of a tree