Math.acos()

Math.acos(x) → number

Returns the arccosine of x.

Returns the angle, in radians, whose cosine is x. The result is in the range 0 to π. Returns NaN if x is outside -1 to 1.

Arguments

NameTypeRequiredDefaultDescription
x number optional — A number between -1 and 1.

Returns

number The arccosine of x, in radians.

Example

let a = Math.acos(0.5); // 1.0471975511965979