
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
JavaScript Math Functions
The following are some of the Math Functions in JavaScript −
S.No |
Method & Description |
---|---|
1 |
abs() Returns the absolute value of a number. |
2 |
acos() Returns the arccosine (in radians) of a number. |
3 |
asin() Returns the arcsine (in radians) of a number. |
4 |
atan() Returns the arctangent (in radians) of a number. |
5 |
atan2() Returns the arctangent of the quotient of its arguments. |
6 |
ceil() Returns the smallest integer greater than or equal to a number. |
Example
Let’s see an example of abs() Math function in JavaScript. The Math() function returns the absolute value of a number −
<html> <head> <title>JavaScript Math abs() Method</title> </head> <body> <script> var value = Math.abs(-1); document.write("First Value : " + value ); var value = Math.abs(5); document.write("<br />Second Value : " + value ); var value = Math.abs("string"); document.write("<br />Third Value : " + value ); </script> </body> </html>
Advertisements