One. Bubble Sort method
<script>
var arr=array ();
for (Var i=0;i<=5;i++) {
var j=prompt ("Please enter the number of +i+");
J=parseint (j);
Arr.push (j);
}
for (Var x=0;x<arr.length;x++) {
for (Var y=x+1;y<arr.length;y++) {
if (Arr[x]<arr[y]) {
var temp=arr[x]; ------Core
Arr[x]=arr[y];
Arr[y]=temp;
}
}
document.write (arr[x]); --------This step does not require the following traversal output (concise)
}
For (var k in arr) {
document.write (Arr[k]);
}
</script>
Two. Go to the heavy
<script>
var attr=[1,1,2,3,4,4,4,5,6,6,6,6];
var arr=array ();
for (var x=0; X<attr.length; x + +) {
var status=0;
for (var y=x+1; Y<attr.length; y++) {
if (Attr[x]==attr[y]) {
Status=1;
Continue
}
}
if (status==0) {
Arr.push (Attr[x]);
}
}
for (Var z in arr) {
document.write (Arr[z]);
}
</script>
Three. Perpetual calendar
<div id= "a" ></div>
<script>
Window.setinterval ("app ()", 1000)
Function app () {
var b=new Date ();
document.getElementById ("a"). inndertext=b.getfullyear+ "" + (B.getmonth () +1) + "" +
B.getdate () + "+b.gethours () +": "+b.getminutes () +": "+b.getseconds ();
}
</script>
Bubble sort, go heavy, perpetual calendar