JavaScript Reference/Javascript Methods/max

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

"max()" Example

   <source lang="javascript">
   

<html> <body> <button onclick="alert(Math.max(1, 2));">MAX</button> </body> </html>


     </source>
   
  


"max()" is applied to

   <source lang="javascript">

+----------------+--------------------------------------------------------------+ | Applied_To |Math | +----------------+--------------------------------------------------------------+

     </source>
   
  


"max()" Syntax, Parameters and Note

   <source lang="javascript">

Note: Evaluates two numbers and returns the larger one.

Syntax:

Math.max(param1, param2) Parameters:

   param1   Required; the first number.
   param2   Required; the second number.
   
     
     </source>