JavaScript 绝对值


JavaScript 绝对值

<html>
   <head>
      <title>JavaScript Math abs() Method</title>
   </head>

   <body>
      <script>
         var value = Math.abs(-10);
         document.write("First Test Value : " + value );
         var value = Math.abs(null);
         document.write("<br />Second Test Value : " + value );
         var value = Math.abs(20);
         document.write("<br />Third Test Value : " + value );
      </script>
   </body>
</html>