- 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
arjun -
Grant Riordan -
Anshi Mehta -
AI Agent Store -
Top comments (0)