- How do you find the largest number in an array? Question: Write a function to find the largest number in an array. Answer:
function findLargestNumber(arr) {
return Math.max(...arr);
}
console.log(findLargestNumber([3, 5, 7, 2, 8])); // Output: 8
function findLargestNumber(arr) {
return Math.max(...arr);
}
console.log(findLargestNumber([3, 5, 7, 2, 8])); // Output: 8
For further actions, you may consider blocking this person and/or reporting abuse
Omolayo Victor -
frontcodelover -
Nuno Tomás -
Maruf Hossain -
Top comments (0)