Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

largest and smallest number in an array 1-100 javascript

let numArray = [95, 1, 75, 7, 12, 50, 3, 88]
numArray.slice().sort(function(a, b) {
  return a - b
})
console.log('smallest: ' + numArray[0] + ', largest: ' + numArray[numArray.length - 1])
Comment

PREVIOUS NEXT
Code Example
Javascript :: check if a key exists in an object javascript 
Javascript :: limit html input to two decimal places 
Javascript :: javascript array any 
Javascript :: requestanimationframe 
Javascript :: react conditional array item 
Javascript :: js - change div height on scroll 
Javascript :: react router route not found redirect 
Javascript :: loop an audio javascript 
Javascript :: js compare elements of two arrays 
Javascript :: angular rellax 
Javascript :: how to display image before upload in jhtml 
Javascript :: disable VirtualizedLists should never be nested inside 
Javascript :: html to react converter 
Javascript :: ref in mongoose example 
Javascript :: v-btn click 
Javascript :: update node js 
Javascript :: javascript array to string remove comma 
Javascript :: javascript random int 
Javascript :: check in node whether the port is working or not 
Javascript :: $unset mongodb 
Javascript :: new date null javascript 
Javascript :: angular remove index of array 
Javascript :: next-auth with linkedin provider 
Javascript :: Check for a Null or Empty String in JavaScript 
Javascript :: javascript fullscreen 
Javascript :: match ids from 2 arrays in javascript asynchronous programming 
Javascript :: going through every attributes of an object javascript 
Javascript :: json full form 
Javascript :: vuejs does props factory function have access to vue instance 
Javascript :: ajax actions wordpress 
ADD CONTENT
Topic
Content
Source link
Name
2+7 =