

- 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 find the largest number contained in a JavaScript array?
To get the largest number in the array, you can try to run the following code. It returns the largest number 530 −
Example
<!DOCTYPE html> <html> <body> <script> var myArr = [340, 25, 530, 299]; var max = myArr.reduce(function(a,b){ return (a > b) ? a : b; }); document.write("Largest number in the array: "+max); </script> </body> </html>
Output
Largest number in the array: 530
- Related Questions & Answers
- How Do I Find the Largest Number in a 3D JavaScript Array?
- Find the largest number in a Java array.
- Find the 3rd largest number in a Java array.
- Find the 2nd largest number in a Java array.
- Java program to find the largest number in an array
- How to find the second largest element in a user-input JavaScript array?
- Java program to find the 3rd largest number in an array
- Java program to find the 2nd largest number in an array
- Constructing largest number from an array in JavaScript
- Python program to find the largest number in a list
- Finding the largest non-repeating number in an array in JavaScript
- Find the difference of largest and the smallest number in an array without sorting it in JavaScript
- 8085 Assembly language program to find largest number in an array
- Python program to find the second largest number in a list
- Python program to find largest number in a list
Advertisements