Dùng Math.sqrt(x) trả về √x. Trả về NaN nếu x âm.
Ví dụ
<html>
<head>
<title>Phương thức Math.sqrt trong JavaScript</title>
</head>
<body>
<script>
document.write("sqrt(0.5) = " + Math.sqrt(0.5) + "<br>"); // ~0.707
document.write("sqrt(49) = " + Math.sqrt(49)); // 7
</script>
</body>
</html>