Click the button to sort the array.
1-9 sort9-1 sortfunctionmyFunction()
{
var points= [40,100,1,5,25,10];
points.sort(function(a,b){returna-b});
varx=document.getElementById("Sorts");
x.innerHTML=points;
}
functionmyFunction2()
{
var points= [40,100,1,5,25,10];
points.sort(function(a,b){returnb-a});
var x=document.getElementById("Sorts");
x.innerHTML=points;
}
Comments
Leave a comment