Math.acos Function (JavaScript)

Returns the arc cosine (or inverse cosine) of a number.

Syntax

Math.acos(number)  

Parameters

The required number argument is a numeric expression.

Return Value

The arc cosine of the number argument, in radians.

Example

The following code shows how to use the acos function.

var v1 = Math.acos(-1.0);  
var v2 = Math.cos(-1.0);  

document.write(v1);  
document.write("<br/>");  
document.write(v2);  

// Output:  
// 3.141592653589793  
// 0.5403023058681398  

Remarks

Applies To: Math Object

Requirements

Supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards, Internet Explorer 11 standards. Also supported in Store apps (Windows 8 and Windows Phone 8.1). See Version Information.

See Also

Math.asin Function
Math.atan Function
Math.cos Function
Math.sin Function
Math.tan Function
Math Object