# 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 E^{x}, 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, base^{exponent}. |
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:**

Test your Programming skills with w3resource's quiz.

## JavaScript: Tips of the Day

**valid Email**

const createMember = ({ email, address = {}}) => { const validEmail = /.+\@.+\..+/.test(email) if (!validEmail) throw new Error("Valid email pls") return { email, address: address ? address : null } } const member = createMember({ email: "[email protected]" }) console.log(member)

The default value of address is an empty object {}. When we set the variable member equal to the object returned by the createMember function, we didn't pass a value for address, which means that the value of address is the default empty object {}. An empty object is a truthy value, which means that the condition of the address ? address : null conditional returns true. The value of address is the empty object {}.

Ref: https://bit.ly/2IUFeTa

**Exercises: Weekly Top 16 Most Popular Topics**- SQL Exercises, Practice, Solution - JOINS
- SQL Exercises, Practice, Solution - SUBQUERIES
- JavaScript basic - Exercises, Practice, Solution
- Java Array: Exercises, Practice, Solution
- C Programming Exercises, Practice, Solution : Conditional Statement
- HR Database - SORT FILTER: Exercises, Practice, Solution
- C Programming Exercises, Practice, Solution : String
- Python Data Types: Dictionary - Exercises, Practice, Solution
- Python Programming Puzzles - Exercises, Practice, Solution
- C++ Array: Exercises, Practice, Solution
- JavaScript conditional statements and loops - Exercises, Practice, Solution
- C# Sharp Basic Algorithm: Exercises, Practice, Solution
- Python Lambda - Exercises, Practice, Solution
- Python Pandas DataFrame: Exercises, Practice, Solution
- Conversion Tools
- JavaScript: HTML Form Validation