var numbers = [20, 25, 25, 35, 15, 35, 15, 18, 58, 66, 45]; var n = []; var quchong = function (event) { for (var i = 0; i < event.length; i++) { if (n.indexOf(event[i]) == -1) n.push(event[i]); } }; quchong(numbers); n.sort(); console.log(n);
js数组的去重和排序
最新推荐文章于 2024-06-01 07:27:22 发布