<script language="JavaScript"> document.write( Math.sqrt( 2 ) + "<br />" ); document.write( Math.sqrt( 3 ) + "<br />" ); document.write( Math.sqrt( 9 ) + "<br />" ); document.write( Math.sqrt( -9 ) ); </script>
运行该例子,输出:
1.4142135623730951 1.7320508075688772 3 NaN