js去除重复项
window.onload = function(){
var array = [12, 14,15,17,12,11,12,14,16]
alert(del(array));
}
function del(arr){
var str = [];
for(var i = 0,len = arr.length;i < len;i++){
! RegExp(arr[i],"g").test(str.join(",")) && (str.push(arr[i]));
}
return str;
}
js去除重复项的更多相关文章
- [LeetCode] Remove Duplicates from Sorted Array 有序数组中去除重复项
Given a sorted array, remove the duplicates in place such that each element appear only once and ret ...
- C#- 泛型去除重复项
今天被这个问题纠结了好一会.如何去除重复项,我遇到的问题是,在判断是否重复的条件是有两个,一个信息来源,一个是信息标题. 最后使用了哈希后很好的解决,感觉挺高效的.代码贴下,做一个备忘 //防止群发, ...
- java 去除重复项
import java.util.Arrays; import java.util.HashSet; import java.util.Set; class Demo20 { public stati ...
- Excel2003 去除重复项
利用 数据透视表 间接 获得 非重复项 1] 选中要去除重复项 的列 数据 2] 3]将选中列移动到 左侧 即可 4] 或者导入到Access中,用sql 语句中的 distinct SELECT D ...
- txt文本怎么去除重复项
txt文本怎么去除重复项?做网络推广的朋友经常会遇到这样的问题,txt文本文件里面有许多人名或者电话号码用来发送邮件或者短信,通常有许多是重复的,下面我来介绍两个方法来去除重复项,以人名为范本讲解. ...
- [LeetCode] 26. Remove Duplicates from Sorted Array 有序数组中去除重复项
Given a sorted array nums, remove the duplicates in-place such that each element appear only once an ...
- [LeetCode] 80. Remove Duplicates from Sorted Array II 有序数组中去除重复项 II
Given a sorted array nums, remove the duplicates in-place such that duplicates appeared at most twic ...
- 为Array对象添加一个去除重复项的方法
输入例子 [false, true, undefined, null, NaN, 0, 1, {}, {}, 'a', 'a', NaN].uniq() 输出例子 [false, true, unde ...
- python3 列表去除重复项保留原序
l1 = ['a',1,'c','b',2,'b','c','d','a'] l2= sorted(set(l1),key=l1.index) print('l2:',l2) print('l1:', ...
随机推荐
- vue框架搭建的详细步骤(一)
在这里我们先快速的搭建一个vue的脚手架: (1).在安装vue的环境之前,安装NodeJS环境是必须的.可以使用node -v指令检查,需要保证安装了4.0版本以上的nodeJS环境. 没有安装的话 ...
- oracle select非group by的字段
可以把group by的结果集当作一个表,然后从这里表里取数就可以了. e.g. SELECT A.PROJECT_CODE,A.DIE_NO,E.ONE_CONSUMING FROM (SELECT ...
- 8、OpenCV Python 图像直方图
__author__ = "WSX" import cv2 as cv import numpy as np from matplotlib import pyplot as pl ...
- Leetcode 91. Decode Ways 解码方法(动态规划,字符串处理)
Leetcode 91. Decode Ways 解码方法(动态规划,字符串处理) 题目描述 一条报文包含字母A-Z,使用下面的字母-数字映射进行解码 'A' -> 1 'B' -> 2 ...
- sharepoint_study_9
描述:sharepoint2013 网站修改导航条标题 SuiteBartext 图示: 解决: 管理员身份进sharepoint powershell ,依次敲入搞定1. $app = Get-SP ...
- Java缓存类loadingCache
<dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artif ...
- python3 杂记
python3 杂记 test001 --test001.py ( from test2.test002 import * def test1(): print('1') if __nam ...
- TXT文件导入到ORACLE数据库中
--创建表 (sqlplus执行) drop table cjw; ),phone ),city ),born ),adressJob ),mail )); ### txt导入到oracle cat ...
- opencv-将分离合并图像(Red通道>125置255<=置0)
#include <iostream> #include <opencv2/opencv.hpp> #include "opencv2/imgproc/imgproc ...
- 转 python trace walk DEMO
https://blog.csdn.net/steadfast123/article/details/46965125 #quote from 'introduction to computation ...