Functions | Description |
---|---|
isNan() | Returns true, if the object is Not a Number. Returns false, if the object is a number. |
parseFloat (string) | If the string begins with a number, the function reads through the string until it finds the end of the number; cuts off the remainder of the string and returns the result. If the string does not begin with a number, the function returns NaN. |
parseInt (string) | If the string begins with an integer, the function reads through the string until it finds the end of the integer, cuts off the remainder of the string and returns the result. If the string does not begin with an integer, the function returns NaN (Not a Number). |
String (object) | Converts the object into a string. |
eval() | Returns the result of evaluating an arithmetic expression. |
function add()
{
var a, b;
var sum = 0;
sum = a + b;
document.write(“Addition : ”+sum);
}
<html>
<body>
<script type="text/javascript">
function add() // Function Declaration
{
var a = 2,b = 3;
var sum = 0;
sum = a+b;
document.write("<b>Addition: </b>"+sum);
}
</script>
<p> Click the Button</p>
<input type="button" onClick="add()" value="Click"> //add() - Calling Function
</body>
</html>