Skip to content

Instantly share code, notes, and snippets.

@thunder775
Created January 10, 2020 05:29
Show Gist options
  • Save thunder775/ad4a7e08d61af049a6a534e8bbb07d47 to your computer and use it in GitHub Desktop.
Save thunder775/ad4a7e08d61af049a6a534e8bbb07d47 to your computer and use it in GitHub Desktop.
let sortingList = function(list){
for(var i = 0;i<list.length;i++){
var max_of_array = Math.min.apply(Math, list.slice(i,list.length));
var index = list.indexOf(max_of_array)
list[index] = list[i]
list[i] = max_of_array
}
console.log(list)
}
sortingList([2,3,1,4,8])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment