该例子从当前的数值中取得年其绝对值:
<script language="JavaScript"> document.write( Math.abs(10.5) + "<br />" ); document.write( Math.abs(-3.15) ); </script>
运行该例子,输出:
10.5 3.15
0