Partners
Web Hosting
We've partnered with HostGator for reliable, affordable hosting starting at $3.95/mon. Use coupon code "javascriptkit25" for 25% off any package.

The Math objectProgrammers are often typecast as good mathematicians. While this is in fact the case with me, I doubt it applies to everyone (small joke). As the scene erupts in a sea of fury, lets just settle on the fact that every mathematician needs a calculator sometimes, or in the case of JavaScript, the Math object. Want to calculate "2.5 to the power of 8" or "Sin0.9" in your script? JavaScript's virtual calculator is what you need. Below lists all of Math's object's properties and methods: Properties
Methods
Let's have JavaScript solve some mathematical problems that have baffled mankind for ages: //calculate e^{5} Math.exp(5) //calculate cos(2PI) Math.cos(2*Math.PI) The "with" statementIf you intend to invoke Math multiple times in your script, a good statement to remember is "with." Using it you can omit the "Math." prefix for any subsequent Math properties/methods: with (Math){ var x= sin(3.5) var y=tan(5) var result=max(x,y) } And with that the tutorial comes to a wrap. Have fun crunching some numbers! 