Account
Categories

var


Definition:

It is a place where you can store values while the program runs.

It stores the value of any type, such as a number, a string, an array, or a boolean.

You can change its value at any time in the program.

It can be used anywhere in the program, inside or outside functions.

Every variable has a name and a value.

It helps programmers manage data.

Variable Name              Value
name
---------->
"Ravi"
Var

Syntax:

var variableName = value;

Example:

var name = "Ravi";