H I O X INDIA
Javascript Tutorial
 HOME  ||  Scripts  ||  Purchase  ||  Tutorials  ||  Images  ||  Tools  ||  Directories 
  :-)  Send Page   :-)   Feedback   :-)   Register   :-)   Links   :-)   Support   :-)   Bookmarks :-)  
 Forums   Hosting   Internet Stats   Easy Calculation   FUN Games 

Java-Script Tutorial
Introduction
Variables
Operators
Statements
Loops
Functions
Objects
Arrays
Browser Objects
Form DOM
Ask Your Doubts
Feedback





Numbers (Integer & Float)


Topic

What are the different variable type of numbers in javascript?
How can I assign integer/float values in java script?



Explanation

Number: Numbers can be used in two different types in javascript. They are integer and float.
Integer- E.g: 2
For a variable to be of int type just assign number with out any quotes.
i.e if
var a = 2;
var b = 2;
then a+b gives 4.

Float- E.g: 2.12
For a variable to be of float type just assign fractional number with out any quotes.
i.e if
var a = 2.12;
var b = 2.12;
then a+b gives 4.24

Important:
Never forget that number types should not have any quotes.

Example Code:
<script language="javascript">
var a = 2;
var b = 3;
var c = a+b;
document.write(" addition - ");
document.write(c);
</script>


Result:
addition - 5


        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.

others

privacy policy     license     sitemap
© 2004-2005 HIOX INDIA - hioxindia.com

Other Links