Breaking News
yeni film izle hd film seyret film izle

Number In Java Script

The number type deals with digits, It covers both floating point numbers and integers.
 
Floating point numbers are like – 412.562, 9.2, 0.468
 
Integer numbers are like : 25, 1258, 968
 
 
Initializing number type variables
 
Var age = 25
Var is javascript keyword, age is a variable name, 25 is value assigned to age variable, variable age is of number type because the value assigned to age is of number type.
 
Var hra = 1585.56
Var is javascript keyword, hra is a variable name, 1585.56 is value assigned to hra variable, variable hra is of number type because the value assigned to hra is of number type.
 
In the example given below we have used keyword document.write (messge ) which is used to print the message or variable value given with it.
 
Example
 
<html>

<head> </head>

<body>

<script type=”text/javascript”>

var age=25;
document.write(“Age is : “+age);

</script >

</body>

</html>

 
 
Understanding the program
 
<script > tag is the start of a javascript program, var is to declare a variable of name age and 25 is the value assigned to the variable age. document.write is used to print the given message and/or value of a given variable. We have used + sign here which is used to concatenate the message ( Age is : ) and the value of variable a (25).
 
 
Output of this program
 
Age is : 25
Click here to view this program in browser
 
Example
 
<html>

<head>

</head>

<body>

<script type=”text/javascript”>

var hra=1585.25;
document.write(“HRA is : “+hra);

</script >

</body>

</html>

 
 
Understanding the program
 
<script > tag is the start of a javascript program, var is to declare a variable of name hra and 1585.25 is the value assigned to the variable hra. document.write is used to print the given message and/or value of a given variable. We have used + sign here which is used to concatenate the message ( HRA is : ) and the value of variable a (1585.25).
 
 
Output of this program
 
HRA is : 25

Check Also

Recursive Functions In Java Script

A function which calls itself, is called a recursive function. When A function calls itself …