

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to get the largest of zero or more numbers in JavaScript?
To get the largest of zero or more number in JavaScript, use the Math.max() method. If no arguments are given, the results are -Infinity.
Syntax
The following in the syntax −
Math.max(value1, value2, ... valueN ) ;
The parameter value1, value, … value N numbers.
Example
You can try to run the following code to get the largest of zero or more numbers −
<html> <head> <title>JavaScript Math max() Method</title> </head> <body> <script> var value = Math.max(24, 220, -80, 100); document.write("First Value : " + value ); var value = Math.max(-10, -24, -98); document.write("<br />Second Value : " + value ); var value = Math.max(0, -1); document.write("<br />Third Value : " + value ); </script> </body> </html>
- Related Questions & Answers
- How to get the smallest of zero or more numbers in JavaScript?
- How to write Python regular expression to get zero or more occurrences within the pattern?
- How to get the largest integer less than or equal to a number in JavaScript?
- Program to find largest of three numbers - JavaScript
- Match any string containing zero or more p's.
- How to increment one or more counters with JavaScript?
- GCD of more than two (or array) numbers in Python Program
- Detecting the largest element in an array of Numbers (nested) in JavaScript
- How to find the common elements between two or more arrays in JavaScript?
- How to attach one or more drop-shadows to the box with JavaScript?
- C++ Program for GCD of more than two (or array) numbers?
- Python Program for GCD of more than two (or array) numbers
- Java Program for GCD of more than two (or array) numbers
- Count of Numbers in Range where the number does not contain more than K non zero digits in C++
- MySQL query to get the count of rows in which two or more specified values appear?
Advertisements