Removes duplicates from the array.
The first method of using for loop
Defines the array var a = [2,3,3,4,5,3,2,6,7,3];
Define an empty array var b=[]
<script type= "Text/javascript" >
var a = [2,3,3,4,5,3,2,6,7,3];
var b = []; for (Var i=0;i<a.length;i++) {var s=0for (var j=0;j<b.length;j++) {if (A[i]==b[j]) {S=1}}if (s==0) {B.push (A[i])}} Alert (b) </script>
The second method of using functions
Defines the array var a = [2,3,3,4,5,3,2,6,7,3];
Define an empty array var b=[]
<script type= "Text/javascript" >var a = [2,3,3,4,5,3,2,6,7,3];var b = []; C (a); function C (a) {for (Var i=0;i<a.length;i++) {if (A.indexof (A[i]) ==i) {B.push (A[i])}}}document.write (b) </ Script>
Three-array sort bubble sort
Sort 7,8,9,3,2,1,4,6,4 from small to large
<script type= "Text/javascript" > var attr=[7,8,9,3,2,1,5,6,4]var zj=0for (var i=0;i<attr.length-1;i++) { for (Var j=0;j<attr.length-1;j++) {if (attr[j]>attr[j+1]) {Zj=attr[j]attr[j]=attr[j+1]attr[j+1]=zj}}}alert ( attr) </script>
Go to heavy and array sort