w3resource

Javascript Math Objects - Properties and Methods

Description

JavaScript math object is a top-level, a predefined object for mathematical constants and functions.

Can not be created by the user. It is a predefined object

Mathematical properties and functions can be calculated by math.property or math.method (for example math.abs(4.568)).

Javascript Math Objects Property

Name Description Version
E Returns the mathematical constant E, the base of natural logarithms, approximately 2.718. Implemented in JavaScript 1.2
LN10 Returns the natural logarithm of 10, approximately 2.302. Implemented in JavaScript 1.2
LN2 Returns the natural logarithm of 2, approximately 0.693. Implemented in JavaScript 1.2
LOG10E Returns the base 10 logarithm of E (approximately equal to 0.434). Implemented in JavaScript 1.2
LOG2E Returns the base 2 logarithm of E (approximately equal to 1.442). Implemented in JavaScript 1.2
PI Returns the ratio of the circumference of a circle to its diameter ( approximately 3.14159). Implemented in JavaScript 1.2
SQRT1_2 Returns the square root of 1/2 i.e. 0.5, approximately 0.707. Implemented in JavaScript 1.2
SQRT2 Returns the square root of 2 (approximately 1.414). Implemented in JavaScript 1.2

Javascript Math Objects Methods

Name Description Version
abs Use to get the absolute value of a number. Implemented in JavaScript 1.2
acos Use to get the arccosine (in radians) of a number. Implemented in JavaScript 1.2
asin Use to get the arcsine (in radians) of a number. Implemented in JavaScript 1.2
atan Use to get the arctangent (in radians) of a number. Implemented in JavaScript 1.2
atan2 Use to get the arctangent of the quotient of its arguments. Implemented in JavaScript 1.2
ceil Use to get the smallest integer, greater than or equal to a number. Implemented in JavaScript 1.2
cos Use to get the the cosine of a number. Implemented in JavaScript 1.2
exp Returns Ex, where x is the argument, and E is Euler's constant, the base of the natural logarithms. Implemented in JavaScript 1.2
floor Use to get the largest integer, less than or equal to a number. Implemented in JavaScript 1.2
log Use to get the natural logarithm (base E) of a number. Implemented in JavaScript 1.2
max Use to get the larger of two given numbers. Implemented in JavaScript 1.2
min Use to get the smaller of two given numbers. Implemented in JavaScript 1.2
pow Returns base to the exponent power, that is, baseexponent. Implemented in JavaScript 1.2
random Use to get the pseudo-random number between 0 and 1. Implemented in JavaScript 1.2
round Use to get the value of a number rounded to the nearest integer. Implemented in JavaScript 1.2
sin Use to get the sine of a number. The sin method returns a numeric value between -1 and 1 Implemented in JavaScript 1.2
sqrt Use to get the square root of a number. Implemented in JavaScript 1.2
tan Use to get the tangent of a number. Implemented in JavaScript 1.2

See also:

JavaScript Core objects, methods, properties.

Test your Programming skills with w3resource's quiz.



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://www.w3resource.com/javascript/object-property-method/math.php