Math.acos()

JavaScript 1.0+, ECMAScript 1.0+, JScript 1.0+ Nav2+, NES2+, IE 3+, Opera3+ Syntax

							math.acos(num)
						

Description

The acos() method of the Math object is used to calculate the arccosine of a number. The return value is between 0 and PI and is measured in radians. If the return value is outside this range, 0 is returned.

Example

Listing 6.152 shows how the acos() method is used and what values can be returned.

Listing 6.152 Example of How to Use acos()
 <html> <body> <script language="JavaScript"> <!–– Hide // function calculates the arccosine of the input number function doMath(){ var inputNum=document.form1.input.value; var result = Math.acos(inputNum); document.form1.answer.value = result; } // End Hide ––> </script> <form ...

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.