Math.acos

acos — Returns the arc-cosine (in radians) of a number.

Description

Math.acos(number number)

Parameters

Name Description Type Default Optional
number A floating number between -1 and 1. number No

Examples

Example #1 – acos example
console.log(Math.acos(0.5)); // 1.0471975511965979 console.log(Math.acos(4)); // NaN console.log(Math.acos(1)); // 0 console.log(Math.acos(-1)); // 3.141592653589793 console.log(Math.acos(0)); // 1.5707963267948966

External references