Explain Variables in Java Script?
https://www.computersprofessor.com/2016/06/explain-variables-in-java-script.html?m=0
Like any programming languages java
script has variables. These are data items, that we can manipulate when the
program runs. A variable is a named value that you can use in your program.
For
example x = 5; here variable name ‘x’ which is set to the value ‘5’. Most
variables in the program doesn’t have fixed values.
Rules for variable names:
There are strick rules governing how you name your variable in java script.
1) Names must (start) begin with
letter digit and underscore.
2) Cannot use white space’s in
variable names.
3) Names are case sensitive, so that
stu; STU; sTU; StU; all are refer to
different variables.
4) Cannot use a reserved word (key
word) as a variable name. reserved words are those words which are the part of
the java script language.
5) Using ‘var’ key word we can create
variables.
Syntax: var variable-name;
Eg:
var a;
Assigning data values to
variables:
Syntax: Variable–name = value;
Eg: a = 5;
b = “sasi”;
c = 87.72;
Initialization of variables: Assigning the data at the time of
declaration is called ‘Initialization’.
Syntax: var variable –name = value;
Eg: var first = “surya”;
var
second = 96665;