JavaScript Tutorial





Español Français 中文 Deutsch Portuguese Japanese nederlands
   
 
Java-Script Tutorial
Introduction Introduction
Variables Variables
Operators Operators
Statements Statements
Loops Loops
Functions Functions
Objects Objects
Arrays Arrays
Cookies JS Cookies
Browser Objects Browser Objects
Form DOM Form DOM
Style Objects DOM Style Objects
Forums Ask Your Doubts
Scraps More about Javascript
Feedback Feedback
 




Variable Types - Javascript


Tutorials Javascript

Topic

What is a variable?
What are the variable types supported by javascript?



Explanation

Variables are used to store values.

i.e. for example if we have to add two numbers, we will declare two variables and assign the numbers to each variable and add them to get the result.
var a = 5;
var b= 5;
var c = a+b;

Javascript can handle the following variable types
a) Number (Integer and Float)
b) String
c) Boolean
d) Null
e) Undefined

In javascript all variable types are declared as var, only depending on how we assign the values the data type is defined.
var a = "as"; --> This is a string type variable
var a = 2; --> This is a integer type variable
var a = true; --> This is a boolean type variable
Here var defines it as a variable.
"a" is the variable name.
"as", 2, true are called values.

The variable name can have alphanumeric values. Any lowercase (a-z) or uppercase (A-Z) alphabets, numbers (0-9) or underscore(_).





A Note
Javascript (JS) is one of the most used languages in the world. Some times spelled as Java Script. Hope you enjoy this tutorial. Do send your feedback or suggestions on this javascript or java script tutorial. This is a copyright content.

Other Links

web hosting