javascript max() method
Translation results:
UK [mæks] US [mæks]
adv.At most
javascript max() methodsyntax
Function: Returns the number with the larger value among the two specified numbers.
Syntax: Math.max(x...)
Parameters: x 0 or more values. Prior to ECMASCript v3, this method had only two parameters.
Returns: The largest value among the parameters. If there are no arguments, -Infinity is returned. If an argument is NaN, or a non-numeric value that cannot be converted to a number, NaN is returned.
javascript max() methodexample
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <script type="text/javascript"> //使用 max() 来返回指定数字中带有最高值的数字 document.write(Math.max(5,7) + "<br />") document.write(Math.max(-3,5) + "<br />") document.write(Math.max(-3,-5) + "<br />") document.write(Math.max(7.25,7.30)) </script> </body> </html>
Run instance »
Click the "Run instance" button to view the online instance
Popular Recommendations
- Basic Protection Against Max Execution Time Limit
- Xiaomi\'s huge TV Max 100 on the way to Europe
- Xiaomi reveals new Robot Vacuum X20 Max as best global model
- iPhone 16 Pro Max lab test reveals its actual charging speed
- Samsung S24 Ultra smokes iPhone 16 Pro Max in battery life test
- AirPods Max refresh brings new colors and a switch to USB-C