please dont rip this site

JavaScript: The Definitive Guide

Previous Chapter 21
JavaScript Reference
Next
 

Math Object

Name

Math Object---placeholder for mathematical functions and constants

Availability

Navigator 2.0, Internet Explorer 3.0

Synopsis

Math.constant
Math.function()

Constants

E

the constant e, the base of the natural logarithm.

LN10

the natural logarithm of 10

LN2

the natural logarithm of 2

LOG10E

the base-10 logarithm of e

LOG2E

the base-2 logarithm of e

PI

the constant pi

SQRT1_2

1 divided by the square root of 2

SQRT2

the square root of 2

Functions

abs()

compute an absolute value

acos()

compute an arc cosine

asin()

compute an arc sine

atan()

compute an arc tangent

atan2()

compute the angle from the X axis to a point

ceil()

round a number up

cos()

compute a cosine

exp()

compute an exponent of e

floor()

round a number down

log()

compute a natural logarithm

max()

return the larger of two numbers

min()

return the smaller of two numbers

pow()

compute xy

random()

compute a random number; not available on all platforms

round()

round to the nearest integer

sin()

compute a sine

sqrt()

compute a square root

tan()

compute a tangent

Description

Math is a read-only reference to a placeholder object that contains mathematical functions and constants. These functions and constants are conveniently grouped by this Math object, and are invoked with syntax like this:

y =index.html Math.sin(x);
area = radius * radius * Math.PI;

Math is actually a "global" property of the Window object, and as such, is usually referred to as Math, rather than as window.Math.

Math is not a class of objects like Date and String are. The Date class, for example, defines methods that operate on Date objects; on instances of the class. Math, on the other hand is simply an object that contains references to functions. These functions happen to be invoked through the Math object, but they do not operate on that object, as methods would.

See Also

"Number"


Previous Home Next
Location.search Book Index Math.abs()

HTML: The Definitive Guide CGI Programming JavaScript: The Definitive Guide Programming Perl WebMaster in a Nutshell

file: /Techref/language/java/script/definitive/refp_219.htm, 8KB, , updated: 2019/10/14 15:00, local time: 2024/11/15 13:56,
TOP NEW HELP FIND: 
3.140.195.249:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://massmind.ecomorder.com/Techref/language/java/script/definitive/refp_219.htm"> [Chapter 21] Reference: Math</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

 

Welcome to ecomorder.com!

 
Quick, Easy and CHEAP! RCL-1 RS232 Level Converter in a DB9 backshell
Ashley Roll has put together a really nice little unit here. Leave off the MAX232 and keep these handy for the few times you need true RS232!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .