<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> <script> var arr=["二师兄","二狗","佐助","蕊蕊","潘","大师兄","临安","文韬","佳龙","戴鑫","平大师","俊义","子安","二狗","佐助","奕豪","蕊蕊","潘","董灏","罗浩"]; // for (var i = arr.length-1; i>0; i--) { // for (var j = 0; j < i; j++) { // if (arr[i]==arr[j]) { // a=arr.splice(j,1); // } // } // } for (var i = 0; i < arr.length; i++) { for (var j = i+1; j <arr.length; j++) { if (arr[i]==arr[j]) { a=arr.splice(j,1); } } } document.write(arr); </script> </body> </html>
数组去重
最新推荐文章于 2023-09-27 17:09:36 发布