JavaScript Tutorial

Define JavaScript

JS Arithmetic Exercise

JavaScript Comment

JavaScript Variable

JavaScript Operators

Conditional Statements

Logical Operators

JavaScript Slider

JS Login Form

JS Popup Boxes

JavaScript Loops

JavaScript Arrays

JS Mouse Events

JS Keyboard Events

Styling Elements

External JavaScript

JS Noscript Tag

JS String Functions

JS Math Functions

JS Date Functions

JS Theme Changer

JS Assignment

Page Stats

Visitor: 90

JavaScript Variable

Variables are the different names used for temporary storage of data. Variable can have any type of value i.e. number, string, boolean, date etc. The data stored in these variables can be changed during the execution of the program. Variable name can be much longer and more descriptive name. While naming the variable you should remember the following points:

  1. No reserved words or keywords are used
  2. You can use both upper or lower case letters, numbers and underscore
  3. Must begin with a letter or underscore, but not with a number

Valid variable name - FirstName, firstname, first_name, Name1

Invalid variable name - 1Name, switch First Name