Math object's properties and methods

The Math object's properties and methods are described below:

NN: Netscape, IE: Internet Explorer

Properties

Syntax: object.property_name

PropertyDescriptionNNIE 
EReturns the base of a natural logarithm23
LN2Returns the natural logarithm of 223
LN10Returns the natural logarithm of 1023
LOG2EReturns the base-2 logarithm of E23
LOG10EReturns the base-10 logarithm of E23
PIReturns PI23
SQRT1_2Returns 1 divided by the square root of 223
SQRT2Returns the square root of 223

Methods

Syntax: object.method_name()

MethodDescriptionNNIE
abs(x)Returns the absolute value of x23
acos(x)Returns the arccosine of x23
asin(x)Returns the arcsine of x23
atan(x)Returns the arctangent of x23
atan2(y,x)Returns the angle from the x axis to a point23
ceil(x)Returns the nearest integer greater than or equal to x23
cos(x)Returns the cosine of x23
exp(x)Returns the value of E raised to the power of x23
floor(x)Returns the nearest integer less than or equal to x23
log(x)Returns the natural log of x23
max(x,y)Returns the number with the highest value of x and y23
min(x,y)Returns the number with the lowest value of x and y23
pow(x,y)Returns the value of the number x raised to the power of y23
random()Returns a random number between 0 and 123
round(x)Rounds x to the nearest integer23
sin(x)Returns the sine of x23
sqrt(x)Returns the square root of x23
tan(x)Returns the tangent of x23
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值