JavaScript Reference/Javascript Objects/Math

Материал из Web эксперт
Перейти к: навигация, поиск

"Math" Example

   <source lang="javascript">
   

<html> <body> <script language="javascript">

   function function1(){
       alert(Math.max(2, 4));
   }

</script> <button onclick="function1();"> Math function returns greater of 2 numbers (2 or 4) </button> </body> </html>


     </source>
   
  


"Math" JavaScript Methods

   <source lang="javascript">

+----------------+--------------------------------------------------------------+ | JavaScript |abs acos | | Methods |asin atan | | |atan2 ceil | | |cos exp | | |floor log | | |max min | | |pow random | | |round sin | | |sqrt tan | +----------------+--------------------------------------------------------------+

     </source>
   
  


"Math" JavaScript Properties

   <source lang="javascript">

+----------------+--------------------------------------------------------------+ | JavaScript |constructor E | | Properties |LN10 LN2 | | |lOG10E lOG2E | | |PI SQRT1_2 | | |SQRT2 | +----------------+--------------------------------------------------------------+

     </source>
   
  


"Math" Syntax and Note

   <source lang="javascript">

Note: Mathematical operations.

Syntax:

Math.memberName


     </source>