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?