JavaScript Math atan ()

Funkcja JavaScript Math.atan () zwraca arcus tangens liczby w radianach.

Składnia Math.atan()funkcji to:

 Math.atan(x)

atan()jako metoda statyczna jest wywoływana przy użyciu Mathnazwy klasy.

Parametry Math.atan ()

Math.atan()Funkcja przyjmuje się:

  • x - liczba, której arcus tangens jest wymagany.

Wartość zwracana z Math.atan ()

  • Zwraca arcus tangens liczby z zakresu od -π / 2 do π / 2 radianów.

Przykład: użycie Math.atan ()

 // using Math.atan() var num = Math.atan(1); console.log(num); // 0.7853981633974483 (pi/4) var num = Math.atan(0); console.log(num); // 0 var num = Math.atan(Infinity); console.log(num); // 1.5707963267948966 (pi/2) var num = Math.atan(Math.pow(3, 0.5)); // square root of 3 console.log(num); // 1.0471975511965976 (pi/3)

Wynik

 0,7853981633974483 0 1,5707963267948966 1,0471975511965976

Zalecane lektury:

  • JavaScript Math tan ()
  • JavaScript Math asin ()

Interesujące artykuły...