The Math, Number, Boolean, and Array Objects Method pow NS2 x NS3 x NS4 x NS6 x IE3a x IE3b x IE4 x IE5 x IE5.5 x IE6 x 611 Returns: Number Returns the value of a base expression raised to a given power. Syntax: Math.pow(base, exponent). ran- dom x x x x x x x x x x Returns: Number Returns a random number between 0 and 1. Syntax: Math.random(). round x x x x x x x x x x Returns: Number Returns an numeric expression rounded to the nearest integer. Math.round(value). If the decimal part of value is 0.5 or greater, the return value is the smallest integer that is still greater than value. Otherwise, the return value is the largest integer less than or equal to value. sin x x x x x x x x x x Returns: Number Returns the sine of a value. Syntax: Math.sin(value), where value is the value, in radians, for which you want the sine. sqrt x x x x x x x x x x Returns: Number Returns the square root of a value. Syntax: Math.sqrt(value), where value is the value, in radians, for which you want the square root. tan x x x x x x x x x x Returns: Number Returns the tangent of a value. Syntax: Math.tan(value), where value is the value, in radians, for which you want the tangent. Using the Math Object You don't need to create an object of the Math type before you use it, you can just use the precreated Math object like this, where I'm using the pow method to create various powers of 2: dim var1 = Math.pow(2, 10) dim var2 = Math.pow(2, 11) dim var3 = Math.pow(2, 12) If you're doing a lot of math calculations, you might want to use the with statement (see "The with Statement" in Chapter 3, "The JavaScript Language: Loops, Functions, and Errors") so that you don't have to preface the Math object's methods with the name Math; here's how that might look: with (Math) { dim var1 = pow(2, 10) dim var2 = pow(2, 11) dim var3 = pow(2, 12) } I'll take a look at some of the ways of using the Math object now.