数组去重
<!doctype html> <html> <head> <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport"> <meta charset="utf-8"> <title></title> </head> <body></body> <script> var arr = [1,1,2,2,3,3,4,4,5,5] var arr2 = []; for(var i = 0 ; i<arr.length;i++){ if(arr2.indexOf(arr[i])==-1){ arr2.push(arr[i]); } console.log(arr2); } </script> </html>