JavaScript - Math asin Method
Descrizione
Questo metodo restituisce l'arcoseno in radianti di un numero. Il metodo asin restituisce un valore numerico compreso tra -pi / 2 e pi / 2 radianti per x compreso tra -1 e 1. Se il valore di numero è al di fuori di questo intervallo, restituisce NaN.
Sintassi
La sua sintassi è la seguente:
Math.asin( x ) ;Dettagli dei parametri
x - Un numero.
Valore di ritorno
Restituisce l'arcoseno in radianti di un numero.
Esempio
Prova il seguente programma di esempio.
<html>  
   <head>
      <title>JavaScript Math asin() Method</title>
   </head>
   
   <body>
      <script type = "text/javascript">
         var value = Math.asin(-1);
         document.write("First Test Value : " + value );
         
         var value = Math.asin(null);
         document.write("<br />Second Test Value : " + value ); 
         
         var value = Math.asin(30);
         document.write("<br />Third Test Value : " + value ); 
         
         var value = Math.asin("string");
         document.write("<br />Fourth Test Value : " + value ); 
      </script>      
   </body>
</html>Produzione
First Test Value : -1.5707963267948966
Second Test Value : 0
Third Test Value : NaN
Fourth Test Value : NaN