Javascript Tutorial - 28 - Math Object
Dave Partner

Javascript Tutorial - 28 - Math Object

  • 0 Replies
  • 304 Views

0 Members and 1 Guest are viewing this topic.

*

Offline Dave Partner

  • Administrator
  • Full Member
  • *****
  • 116
    • View Profile
Javascript Tutorial - 28 - Math Object
« on: January 05, 2017, 06:16:42 AM »


<html>
   <head>
      <title></title>
      
   </head>
   <body>
      <script type="text/javascript" >
         /*
            MATH OBJECT
            
            pow()   Returns base to the exponent power, that is, base exponent.
            random()Returns a pseudo-random number between 0 and 1.
            max()   Returns the largest of zero or more numbers.
            min()   Returns the smallest of zero or more numbers.
            round()   Returns the value of a number rounded to the nearest integer.
            sqrt()   Returns the square root of a number.
            ceil()   Returns the smallest integer greater than or equal to a number.
            floor()   Returns the largest integer less than or equal to a number.
            abs()   Returns the absolute value of a number.
            acos()   Returns the arccosine (in radians) of a number.
            asin()   Returns the arcsine (in radians) of a number.
            atan()   Returns the arctangent (in radians) of a number.
            atan2()   Returns the arctangent of the quotient of its arguments.
            cos()   Returns the cosine of a number.
            exp()   Returns EN, where N is the argument, and E is Euler's constant, the base of the natural logarithm.
            log()   Returns the natural logarithm (base E) of a number.
            sin()   Returns the sine of a number.
            tan()   Returns the tangent of a number.
            toSource()   Returns the string "Math".
         */
         
         //var answer = Math.pow(8, 2);
         
         
         //document.write(Math.random());
         
         //document.write(Math.max(13, 10));
         
         /*var user1Balance = 13;
         var user2Balance = 10;
         var user3Balance = 6;
         
         var answer1 = Math.min(user1Balance, user2Balance);
         
         var answer2 =  Math.min(user3Balance, answer1);
         
         document.write(answer2);
         
         */
         
         //document.write(Math.sqrt(16));
         
         //document.write(Math.ceil(16.22));
         
         //document.write(Math.floor(16.22));
         //document.write(Math.round(16.52));
         
      </script>
      
      
      
   </body>
</html>