I want to sort an array based on the elements, how can I do that in Javascript?
Use sort method like below to sort the elements of an array
sort
let numbers = [ 1 , 9, 3, 7, 2, 5 ]; console.log(numbers.sort());