Javascript Data Types

Javascript Data Types  

a  variable has a data type that indicates what kind of  data the variable holds.

Boolean : –  it takes one of two values : true or false. used both as a variable values and within loops and conditions as a literal.

Example :  True , false

Null :- Has only one value . Indicates the absence of data;  Example : null

Number :- Includes both integer and floating-point types.

Example :- 5, 123.34, -34;


String :- Zero or more Unicode Characters delimited by either single or double quotes. There is no meaning difference for the type of quotes , and they are interchangeable. The quote flexibility is useful for including script code within markup.

Example :-  “Hello”, “Tutorial”


Weak Typing : – JavaScript is weak typing Language. Every JavaScript  variable  has a data type, java script’s automatic type inference is that  a variable ‘ type can change dynamically.

Example  :  a variable can hold string data type and later be assigned a integer data type.



Document.write(4* “4”);

We can change data type in javascript using different methods like parseInt() and parseFloat().

Var  a=parseInt(“4”);

Var b=parseInt(“test”);

Var c=parseFloat(“34”);




Follow Us

Contact Us

Back to Top