当前位置: 首页 > 网络学院 > 客户端脚本教程 > JavaScript > JS数学对象参考
FF: Firefox, N: Netscape, IE: Internet Explorer
FF:火狐,N:网景,IE
| Method 方法 | Description 描述 | FF | N | IE |
|---|---|---|---|---|
| abs(x) | Returns the absolute value of a number 返回数字的绝对值 | 1 | 2 | 3 |
| acos(x) | Returns the arccosine of a number 返回数字的反余弦值 | 1 | 2 | 3 |
| asin(x) | Returns the arcsine of a number 返回数字的反正弦值 | 1 | 2 | 3 |
| atan(x) | Returns the arctangent of x as a numeric value between -PI/2 and PI/2 radians 返回位于-PI/2 和 PI/2 的反正切值 | 1 | 2 | 3 |
| atan2(y,x) | Returns the angle theta of an (x,y) point as a numeric value between -PI and PI radians 返回(x,y)位于 -PI 到 PI 之间的角度 | 1 | 2 | 3 |
| ceil(x) | Returns the value of a number rounded upwards to the nearest integer 返回 x 四舍五入后的最大整数 | 1 | 2 | 3 |
| cos(x) | Returns the cosine of a number 返回一个数字的余弦值 | 1 | 2 | 3 |
| exp(x) | Returns the value of Ex 返回 E^x 值 | 1 | 2 | 3 |
| floor(x) | Returns the value of a number rounded downwards to the nearest integer 返回 x 四舍五入后的最小整数 | 1 | 2 | 3 |
| log(x) | Returns the natural logarithm (base E) of a number 返回底数为E的自然对数 | 1 | 2 | 3 |
| max(x,y) | Returns the number with the highest value of x and y 返回 x 和 y 之间较大的数 | 1 | 2 | 3 |
| min(x,y) | Returns the number with the lowest value of x and y 返回 x 和 y 之间较小的数 | 1 | 2 | 3 |
| pow(x,y) | Returns the value of x to the power of y 返回 y^x 的值 | 1 | 2 | 3 |
| random() | Returns a random number between 0 and 1 返回位于 0 到 1 之间的随机函数 | 1 | 2 | 3 |
| round(x) | Rounds a number to the nearest integer 四舍五入后取整 | 1 | 2 | 3 |
| sin(x) | Returns the sine of a number 返回数字的正弦值 | 1 | 2 | 3 |
| sqrt(x) | Returns the square root of a number 返回数字的平方根 | 1 | 2 | 3 |
| tan(x) | Returns the tangent of an angle 返回一个角度的正切值 | 1 | 2 | 3 |
| toSource() | Represents the source code of an object 显示对象的源代码 | 1 | 4 | - |
| valueOf() | Returns the primitive value of a Math object 返回数学对象的原始值 | 1 | 2 | 4 |
| Property 属性 | Description 描述 | FF | N | IE |
|---|---|---|---|---|
| constructor | A reference to the function that created the object 所建立对象的函数参考 | 1 | 2 | 4 |
| E | Returns Euler's constant (approx. 2.718) 返回欧拉常数(近似于2.718) | 1 | 2 | 3 |
| LN2 | Returns the natural logarithm of 2 (approx. 0.693) 返回2 的自然对数(近似值:0.693) | 1 | 2 | 3 |
| LN10 | Returns the natural logarithm of 10 (approx. 2.302) 返回10 的自然对数(近似值:2.302) | 1 | 2 | 3 |
| LOG2E | Returns the base-2 logarithm of E (approx. 1.414) 返回以2为底的对数的数学常数,表示为log10e(近似值:1.414) | 1 | 2 | 3 |
| LOG10E | Returns the base-10 logarithm of E (approx. 0.434) 返回以10为底的对数的数学常数,表示为log10e(近似值:0.434) | 1 | 2 | 3 |
| PI | Returns PI (approx. 3.14159) 返回圆周率PI(近似值:3.14159) | 1 | 2 | 3 |
| prototype | Allows you to add properties and methods to the object 可为对象加入的属性和方法 | 1 | 2 | 4 |
| SQRT1_2 | Returns the square root of 1/2 (approx. 0.707) 返回1/2的平方根(近似值:0.707) | 1 | 2 | 3 |
| SQRT2 | Returns the square root of 2 (approx. 1.414) 返回2的平方根(近似值:1.414) | 1 | 2 | 3 |
评论 (0) All