acos()  Math  class method JS Home  <<  JS Reference  <<  Math  <<  acos()

Description

Returns the arccosine of a number in radians.

  • Radians to Degrees - divide number by (Math.PI / 180).
  • Degrees to Radians - multiply number by (Math.PI * 180).
  • Like all class methods acos() should be used on the class rather than an instance of the class.

Syntax

Signature Description
Math.acos(value)Returns the arccosine of a number in radians.

Parameters

Parameter Description
valueThe number you wish to find the arccosine in radians for:
  • A number in the range -1 to 1.
  • Values outside this range return NaN.

Examples

The code below displays acos() usage.


// Store results in an array.
var acosValues = new Array(5);

acosValues[0] = Math.acos(-1);
acosValues[1] = Math.acos(0);
acosValues[2] = Math.acos(0.75);
acosValues[3] = Math.acos(-2);
acosValues[4] = Math.acos('a string');
acosValues[5] = Math.acos();

alert(acosValues);  

Press the button below to action the above code:

Related Tutorials

JavaScript Advanced Tutorials - Lesson 4 - Math

JavaScript Basics

JavaScript Basics

JavaScript Intermediate

JavaScript Intermediate

JavaScript Advanced

JavaScript Advanced

JavaScript Reference

JavaScript Entities

Globals

Math

Class Properties
E
LN2
LN10
LOG2E
LOG10E
PI
SQRT1_2
SQRT2
Instance Properties
None.
Class Methods
abs()
acos()
asin()
atan()
atan2()
ceil()
cos()
exp()
floor()
log()
max()
min()
pow()
random()
round()
sin()
sqrt()
tan()
Instance Methods Getters
None.
Instance Methods Setters
None.

Statements

Operators