Dùng Math.atan(x) trả về arctan của x (radian), giá trị trong (-π/2, π/2).
Ví dụ
<html>
<head>
<title>Phương thức Math.atan trong JavaScript</title>
</head>
<body>
<script>
document.write("atan(-1) = " + Math.atan(-1) + "<br>"); // -π/4
document.write("atan(0.5) = " + Math.atan(0.5) + "<br>");
document.write("atan(30) = " + Math.atan(30) + "<br>");
document.write("atan('text') = " + Math.atan("Demo Text")); // NaN
</script>
</body>
</html>