JavaScript VariableA JavaScript variable is simply a name of storage location. There are two types of variables in JavaScript : local variable and global variable.
There are some rules while declaring a JavaScript variable (also known as identifiers).
Correct JavaScript variablesIncorrect JavaScript variablesExample of JavaScript variableLet’s see a simple example of JavaScript variable. Test it NowOutput of the above exampleJavaScript local variableA JavaScript local variable is declared inside block or function. It is accessible within the function or block only. For example: Or, JavaScript global variableA JavaScript global variable is accessible from any function. A variable i.e. declared outside the function or declared with window object is known as global variable. For example: Test it NowTo know more about global variable (e.g. how global variable is executed by JavaScript execution engine), visit next page.
Next TopicJavaScript Global Variable
|
JavaTpoint offers too many high quality services. Mail us on h[email protected], to get more information about given services.
JavaTpoint offers college campus training on Core Java, Advance Java, .Net, Android, Hadoop, PHP, Web Technology and Python. Please mail your requirement at [email protected].
Duration: 1 week to 2 week