Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Get the Smallest Element of an Array, array js

const getSmallest = (arr) =>
  arr.reduce((smallest, num) => Math.min(smallest, num));
const arr = [13, 7, 11, 3, 9, 15, 17];
console.log(getSmallest(arr)); // 3
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Get #Smallest #Element #array #js
ADD COMMENT
Topic
Name
7+8 =