javascript
Javascript Code for Sorting array and finding Largest No. in Array
let arr = [1,25,51,36,45,13,101]
const sorted = arr.sort((a, b) => a - b);
const Largest = arr.sort((a, b) => a - b)[arr.length - 1];
console.log(sorted)
console.log(Largest)
Was this helpful?
Similar Posts
- Finding the max/min value of an attribute in an array of objects
- Get the largest value from an array using javascript
- Find the nth largest element in a sorted array
- Javascript code to remove falsy value like null, undefined, false from array
- CODE GENERATOR
- jQuery code to run a function after page load
- Get Top MAX and MIN itens inside array Javascript