SQL PHP HTML ASP JavaScript articles and free scripts to download

Math function

JavaScript has some good collection of Math functions to handle various requirements. These functions we can inside our script based on the logic required. We can check a variable if it is a number or we can format a number or we can rounded off a number by using these Math function and can do much more than this. Here are some tutorials on handling math function.

Simple addition

We can add to numbers and display the result like this

var x=2+5
document.write(x);

Subtraction

var x =4-2
document.write(x);

Multiplication

var x=4*9
document.write(x);

Division

var x=12/7;
document.write(x);

To get the reminder of this division we have to use modulus.
Functions Description
ConstantsMath Constants used in JavaScript
random()Generating random numbers
round()Function to get rounded value of a number
IsNaN()function to check data : if number or not
ceil() function to get just next higher integer
floor() function to get just highest lower integer
toFixed() function to format decimal places of a number
toPrecision()function to fix the places of a number
parseFloat()function to convert string to floating number
parseInt()function to convert string to number
modulus %to get the reminder of a division
pow to get the power of an integer
min to get the lowest integer from a set of number
max to get the highest integer from a set of number
abs to get the absolute value from any integer
sqrtto get square root of any number
log to get the log value of number
expto get E to the power of X
Math conversion from one base to other number system
Demo Scripts Description
CalculatorAdding two numbers as entered by user
Feet - MeterConverting feet data to meter and vice versa

Google+

Post Comment This is for short comments only. Use the forum for more discussions.
Name
Email( not to be displayed)Privacy Policy
1+2=This is to prevent automatic submission by spammers. Please enter the result of the sum as asked




Join Our Email List
Email:  
For Email Newsletters you can trust
HTML . MySQL. PHP. JavaScript. ASP. Photoshop. Articles. FORUM Contact us

©2000-2014 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer