Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Get the Largest Element of an Array, array js

const getLargest = (arr) =>
  arr.reduce((largest, num) => Math.max(largest, num));
const arr = [13, 7, 11, 3, 9, 15, 17];
console.log(getLargest(arr)); // 17
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Get #Largest #Element #array #js
ADD COMMENT
Topic
Name
4+2 =