Javascript Math asin()

Introduction

The Math.asin() function returns the arcsine in radians of a number.

Math.asin(x)   // x is a number.

The arcsine in radians of the given number if it's between -1 and 1; otherwise, NaN.

let a= Math.asin(-2);  // NaN
console.log(a);/*from   w w  w. ja v a2 s .c o  m*/
a= Math.asin(-1);  // -1.5707963267948966 (-pi/2)
console.log(a);
a= Math.asin(0);   // 0
console.log(a);
a= Math.asin(0.5); // 0.5235987755982989
console.log(a);
a= Math.asin(1);   // 1.5707963267948966 (pi/2)
console.log(a);
a= Math.asin(2);   // NaN
console.log(a);



PreviousNext

Related