# JavaScript acos() Method

## Definition and Usage

The acos() method returns the arccosine of a number as a numeric value value between 0 and PI radians.## Syntax

Math.acos(x) |

Parameter | Description |
---|---|

x | Required. Must be a numeric value in the range -1 to 1 |

## Tips and Notes

**Note:**If the parameter x is outside the range -1 to 1, the browser will return NaN.

**Note:**-1 will return the value of PI.

## Example

In this example we will get the arccosine of different numbers:<script type="text/javascript"> document.write(Math.acos(0.64) + "<br />"); document.write(Math.acos(0) + "<br />"); document.write(Math.acos(-1) + "<br />"); document.write(Math.acos(1) + "<br />"); document.write(Math.acos(2)); </script> |

The output of the code above will be:

0.8762980611683406 1.5707963267948965 3.141592653589793 0 NaN |

JavaScript acos() Method
Reviewed by 1000sourcecodes
on
02:59
Rating: