javascriptdistinct的简单介绍

JavaScript除去数组中重复

这里我给出一个方法哈, Array.prototype.uniqueEx=function(){

var l=this.length;

var arr=[];

var tmp={}

for(var i=0;il;i++){

if(!tmp[this[i]]){

arr.push(this[i]);

tmp[this[i]]=1;

}

}

return arr;

} 和上面那个朋友给出打答案比较起来 ,代码似乎更多一点, 但是效率更高 我做了下测试 ,同样大小的数组,它的代码执行起来,需要耗费5毫秒, 而我的代码间隔是0.几毫秒。 如果数组更大,他的那种方法,效率明显要低很多 。 效率测试代码如下: script type=”text/javascript”Array.prototype.unique=function(filo) {

with(this) return filo ?

join(“,”).match( /([^,]+)(?!.*\1)/ig ) :

reverse().join(“,”).match( /([^,]+)(?!.*\1)/ig ).reverse();

}

Array.prototype.uniqueEx=function(){

var l=this.length;

var arr=[];

var tmp={}

for(var i=0;il;i++){

if(!tmp[this[i]]){

arr.push(this[i]);

tmp[this[i]]=1;

}

}

return arr;

}var testarr=[1, 1, 1, 1, 2, 3, 4, 1, 2, 5,1, 1, 1, 1, 2, 3, 4, 1, 2, 5,1, 1, 1, 1, 2, 3, 4, 1, 2, 5,1, 1, 1, 1, 2, 3, 4, 1, 2, 5,1, 1, 1, 1, 2, 3, 4, 1, 2, 5,1, 1, 1, 1, 2, 3, 4, 1, 2, 5,1, 1, 1, 1, 2, 3, 4, 1, 2, 5,1, 1, 1, 1, 2, 3, 4, 1, 2, 5,1, 1, 1, 1, 2, 3, 4, 1, 2, 5,1, 1, 1, 1, 2, 3, 4, 1, 2, 5,1, 1, 1, 1, 2, 3, 4, 1, 2, 5,1, 1, 1, 1, 2, 3, 4, 1, 2, 5,1, 1, 1, 1, 2, 3, 4, 1, 2, 5,1, 1, 1, 1, 2, 3, 4, 1, 2, 5,1, 1, 1, 1, 2, 3, 4, 1, 2, 5,1, 1, 1, 1, 2, 3, 4, 1, 2, 5,1, 1, 1, 1, 2, 3, 4, 1, 2, 5,1, 1, 1, 1, 2, 3, 4, 1, 2, 5,1, 1, 1, 1, 2, 3, 4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, 1, 2, 5,1, 1, 1, 1, 2, 3, 4, 1, 2, 5,1, 1, 1, 1, 2, 3, 4, 1, 2, 5,1, 1, 1, 1, 2, 3, 4, 1, 2, 5,1, 1, 1, 1, 2, 3, 4, 1, 2, 5,1, 1, 1, 1, 2, 3, 4, 1, 2, 5,1, 1, 1, 1, 2, 3, 4, 1, 2, 5,1, 1, 1, 1, 2, 3, 4, 1, 2, 5,1, 1, 1, 1, 2, 3, 4, 1, 2, 5,1, 1, 1, 1, 2, 3, 4, 1, 2, 5,1, 1, 1, 1, 2, 3, 4, 1, 2, 5,1, 1, 1, 1, 2, 3, 4, 1, 2, 5,1, 1, 1, 1, 2, 3, 4, 1, 2, 5,1, 1, 1, 1, 2, 3, 4, 1, 2, 5,1, 1, 1, 1, 2, 3, 4, 1, 2, 5,1, 1, 1, 1, 2, 3, 4, 1, 2, 5,1, 1, 1, 1, 2, 3, 4, 1, 2, 5,1, 1, 1, 1, 2, 3, 4, 1, 2, 5,1, 1, 1, 1, 2, 3, 4, 1, 2, 5,1, 1, 1, 1, 2, 3, 4, 1, 2, 5,1, 1, 1, 1, 2, 3, 4, 1, 2, 5];var timeold=new Date().getTime();

testarr=testarr.unique(); //这个是他的

var timenew=new Date().getTime();

alert(timenew-timeold);

alert(testarr); timeold=new Date().getTime();

testarr2=testarr2.uniqueEx(); //这个是我的

timenew=new Date().getTime();

alert(timenew-timeold);

alert(testarr2);/*对比一下2种方法的运算时间,就知道了*//script

js中怎么把数组中重复的数据取出来

需要准备的材料分别是:电脑、html编辑器、浏览器。

1、首先,打开html编辑器,新建html文件,例如:index.html。

2、在index.html的script标签中,输入js代码:

var a = [1, 6, 8, 5, 23, 6, 6, 7, 8], b = [], c = [];

for (var i = 0; i a.length; i++) {

if (c.indexOf(a[i]) === -1) {

c.push(a[i]);

} else {

b.push(a[i]);

}

}

document.body.innerText = b;

3、浏览器运行index.html页面,此时会打印出数组a中重复的数据。

javascriptdistinct的简单介绍

mongo中的高级查询之聚合操作(distinct,count,group)与数据去重

Mongodb中自带的基本聚合函数有三种:count、distinct和group。下面我们分别来讲述一下这三个基本聚合函数。

(1)count

作用:简单统计集合中符合某种条件的文档数量。

使用方式:db.collection.count(query)或者db.collection.find(query).count()

参数说明:其中query是用于查询的目标条件。如果出了想限定查出来的最大文档数,或者想统计后跳过指定条数的文档,则还需要借助于limit,skip。

举例:

db.collection.find(query).limit();

db.collection.find(query).skip();

(2)distinct

作用:用于对集合中的文档针进行去重处理

使用方式:db,collection.distinct(field,query)

参数说明:field是去重字段,可以是单个的字段名,也可以是嵌套的字段名;query是查询条件,可以为空;

举例:

db.collection.distinct(“user”,{“age”:{$gt:28}});//用于查询年龄age大于28岁的不同用户名

除了上面的用法外,还可以使用下面的另外一种方法:

db.runCommand({“distinct”:”collectionname”,”key”:”distinctfied”,”query”:query})

collectionname:去重统计的集合名,distinctfield:去重字段,,query是可选的限制条件;

举例:

这两种方式的区别:第一种方法是对第二种方法的封装,第一种只返回去重统计后的字段值集合,但第二种方式既返回字段值集合也返回统计时的细节信息。

(3)group

作用:用于提供比count、distinct更丰富的统计需求,可以使用js函数控制统计逻辑

使用方式:db.collection.group(key,reduce,initial[,keyf][,cond][,finalize])

备注说明:在2.2版本之前,group操作最多只能返回10000条分组记录,但是从2.2版本之后到2.4版本,mongodb做了优化,能够支持返回20000条分组记录返回,如果分组记录的条数大于20000条,那么可能你就需要其他方式进行统计了,比如聚合管道或者MapReduce;

===========================================================

mongo中的高级查询之聚合操作(distinct,count,group)

1.distinct的实现:

2.count的实现

3.group的实现

(1).分组求和:类似于mysql中的 select act,sum(count) from consumerecords group by act

(2).分组求和,过滤。类似mysql中的select act,sum(count) from consumerecords group by act having act=’charge’;

(3).将时间格式化并且按时间分组求count,不推荐使用这种方法。

db.playerlogs.aggregate({ concat:[{ year:” substr:[{ start”},0,4]},{ dayOfMonth:” group:{_id:” sum:1}}},{$sort:{con:1}}) ;

group按时间分组(时间格式化)

javascriptz中时间的相关函数参考:

(4).group 分组方法实现的讲解。

group 的完整语法是。

参数解释:

key:需要分组的键或是函数(function),group分组实例3中的key就是一个函数值

initial:声明并且初始化变量。每一组共享一个变量值。多个变量之间用逗号隔开

$reduce:循环体,集合中有多少个文档,就会循环多少次。函数(function)中变量doc表示当前文档对象,

prev表示累积处理的结果对象(这个地方可能描述的不是很情况,自己慢慢体会)

finalize:可选参数,可以简单理解为对分组之后的结果的再次处理,doc表示group之后的文档对象(这一步也是一个循环体

condition:可选参数,对已经分组好的结果进行过滤,有点类似于mysql中的having

4.mapReduce:暂缺,要想玩转这个方法需要有很强的JavaScript功能。

据说mapReduce 可以实现很复杂的查询,可以将一个复杂的查询分拆到多个机器上运行,

然后把各个结果集组合起来,形成最终结果。但是很慢。

mapreduce用法大全

mapreduce性能调优

数组中去除重复值示例

5.db.runCommand的相关命令.

db.runCommand({distinct:”consumerecords”,key:”userId”}):键值去重 类似于mysql中的 select distinct userId from consumerecords

db.runCommand({distinct:”consumerecords”,key:”userId”}).values.length:去重之后求记录数,类似于mysql中的 select count(distinct userId) from consumerecords

db.runCommand({distinct:”consumerecords”,key:”userId”,query:{act:”charge”}}):去重之后求记录数,类似于mysql中的 select distinct userId from consumerecords where act=”charge”

db.runCommand(

… {

… group:

… {

… ns:”test2″, # 集合名

… key:{iname:true}, # 分组字段

… initial:{dd:0}, # 按照来初始化该值

… reduce之后 ,function返回的值

… {

… prev.dd=doc.iage+prev.dd #

… }

… }

… }

… )

数值以字符串形式存储的解决方案:

db.runCommand(

{

group:

{

ns:”consumerecords”,

key:{act:true},

initial:{ct:100,tt:0},

$reduce:function(doc,prev)

{

},

}

}

)

去重

1, 直接使用distinct 语句查询, 这种查询会将所有查询出来的数据返回给用户, 然后对查询出来的结果集求总数(耗内存,耗时一些)

var len = db.student.distinct(“name”,{“age” : 18}).length;

print(len)

注,使用这种方法查询时,查询的结果集大于16M 时会查询失败,失败信息如下:

{“message” : “distinct failed: MongoError: distinct too big, 16mb cap”,”stack” : “script:1:20”}

2, 使用聚合函数,多次分组统计结果,最终将聚合的结果数返回给用户

db.student.aggregate([

{ project:{“name”:true}},

{ name”}},

{ sum:1}}}

])

注,这种查询数据量大时就不会出现如上查询失败的情况,而且这种查询不管是内存消耗还是时间消耗都优于上面一种查询

ps:根据id分组,id指定为组合项的话,因为id不会重复,所以作用相当于把组合项去重了。

假如现在需要拿出collection的其他field的话,可以使用$push关键字

// 根据name和sex分组

// 把分组后的name,sex,age放到对应的Document下,形成一个数组

db.student.aggregate(

[

{

name”, sex: ” push: ” push: ” push: “$age”}

}

}

]

). forEach(function(x){

db.temp.insert(

{

name: x.name,

sex : x.sex,

age: x.age

}

);

});

用forEach、indexOf、push实现数组去重

方法一:去重复数据

script

Array.prototype.distinct=function(){

var a=[],b=[];

for(var prop in this){

var d = this[prop];

if (d===a[prop]) continue; //防止循环到prototype

if (b[d]!=1){

a.push(d);

b[d]=1;

}

}

return a;

}

var x=[‘a’,’b’,’c’,’d’,’b’,’a’,’e’,’a’,’b’,’c’,’d’,’b’,’a’,’e’];

document.write(‘原始数组:’+x);

document.write(“br /”);

document.write(‘去重复后:’+x.distinct());

/script

方法二:取重复数据

script type=”text/javascript”

Array.prototype.distinct=function(){

var a=[],b=[],c=[],d=[];

for(var prop in this){

var d = this[prop];

if (d===a[prop])

{

continue;

}//防止循环到prototype

if (b[d]!=1){

a.push(d);

b[d]=1;

}

else {

c.push(d);

d[d]=1;

}

}

//return a;

return c.distinct1();

}

Array.prototype.distinct1=function(){

var a=[],b=[];

for(var prop in this){

var d = this[prop];

if (d===a[prop]) continue; //防止循环到prototype

if (b[d]!=1){

a.push(d);

b[d]=1;

}

}

return a;

}

javascript里面的字面量是什么意思啊?

字面量表示如何表达这个值,一般除去表达式,给变量赋值时,等号右边都可以认为是字面量。

字面量分为字符串字面量(string literal )、数组字面量(array literal)和对象字面量(object literal),另外还有函数字面量(function literal)。

示例:

var test=”hello world!”;

“hello world!”就是字符串字面量,test是变量名。

javascript总for of和for in的区别

The for…of statement creates a loop iterating over iterable objects (including Array, Map, Set,String, TypedArray, arguments object and so on), invoking a custom iteration hook with statements to be executed for the value of each distinct property.

The for…in statement iterates over the enumerable properties of an object, in arbitrary order. For each distinct property, statements can be executed.

                                                                                                          ———-from MDN

可以看出for…in遍历的是Object(包括Array)中的可枚举的属性,但是顺序是随机的,随着引擎不同而不同

但是for…of是对可遍历对象创建了一个循环,对对象里面每个元素调用一个钩子函数(个人理解就是可遍历对象要求实现的next()函数),输出结果

本文来自投稿,不代表【】观点,发布者:【

本文地址: ,如若转载,请注明出处!

举报投诉邮箱:253000106@qq.com

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2024年3月25日 19:44:19
下一篇 2024年3月25日 19:51:46

相关推荐

  • linuxiproutenull的简单介绍

    Linux配置ip地址的两种方法 1、在 Linux 系统中设置 IP 地址可以通过命令行或者图形界面来完成。 2、首先进入到Linux系统中,输入用户名和密码完成登录。然后在命令提示符后面,输入命令ifconfig查看当前IP地址。下面三个IP地址分别表示:IP地址、广播地址、子网掩码,这里需要修改第一个IP地址。 3、打开Linux终端系统,然后在系统中…

    2024年5月19日
    4500
  • java导出txt文件的简单介绍

    java中输出txt文件 在新建好的文件夹中新建一个文本文档,把文档名改为HelloWorld.java,并在该文档中写好如下程序。 在D盘新建两个文件test.txt,testtxt 把内容拷到test中,test1为输出。。 《java 程序》百度网盘资源免费在线观看 链接:提取码:1mur Java是一门面向对象编程语言,不仅吸收了C++语言的各种优点…

    2024年5月19日
    3100
  • javascriptarcgis的简单介绍

    arcgis+maps+SDK+for+JavaScript是开源吗? 跟随ArcGIS 3同时发布的,是ESRI根据JavaScript技术实现的调用ArcGIS Server REST API接口的一组脚本。当前的最新版本是Version 12。 dotspatial、gmap.net都是.NET平台下可进行二次开发的开源GIS库,完全免费,dotspa…

    2024年5月19日
    3600
  • linuxgdbdefunct的简单介绍

    如何使用linux下gdb来调试python程序 gdb是用来调试二进制程序的,不能调试python脚本。python自带pdb模块,可以用来调试自己的脚本。使用python -m pdb 脚本.py,交互方式,命令与gdb类似。 Attach子进程众所周知,GDB有附着(attach)到正在运行的进程的功能,即attach pid命令。因此我们可以利用该命…

    2024年5月19日
    3700
  • javatreemapsubmap的简单介绍

    java中几种Map在什么情况下使用? 如果你需要通过一个名字去获取数据的时候就可以用Map。如果你只是从数据库查询出来,很多条数据,那就放到List。假如你有List ,你要获取名字为张三的学生的其他信息,那么你就需要循环List 然后判断student的名字是张三。 Map有:HashMap、TreeMap、Hashtable。HashMap:线程不安全…

    2024年5月19日
    2800
  • linuxpam无法ssh的简单介绍

    【OpenSSH】关于升级openssh后ulimit不生效问题的解决方法 卸载系统自带的openssh之前,最好是备份一下/etc/pam.d/sshd,编译完之后 ,查看/etc/pam.d如果没有sshd文件,就恢复备份。 ssh 普通用户@ip 登陆时,发现ulimit值还是系统默认的1024。于是,立即想到是ssh的问题导致的。因为不久之前将ope…

    2024年5月19日
    3200
  • javaeclipseprofile的简单介绍

    eclipse怎么配置java开发px4 1、首先需要安装JDK。一步一步来就行。注意选择安装路径,或者是默认路径即可。比如我选择的安装目录为:E:\Program Files (x86)\Java\ 3接下来进行Java环境变量配置。 2、下载、安装JDK,从Oracel官方网站上下载,或者直接搜索jdk 安装JDK,选择安装目录。完成安装后配置环境变量,…

    2024年5月19日
    3300
  • javajframe窗口大小的简单介绍

    用JAVA怎么建立一个大小为300*200的JFrame窗体,在里面添加三个标签… 1、(1) 文本框只能输入纯数字;(2) 界面较美观;(3) 代码可读性较好,有适当的注释;(4) 窗体一出现就在桌面居中。 2、这样就可以啊,如果有具体问题,把你的代码发出来。 3、怎么用java设计一个窗口,要求功能如下: 100 他要实现的功能就是:点击一个…

    2024年5月19日
    3300
  • linux获得某个进程所有子进程的简单介绍

    linux查看是否有某个运行的进程命令 linux 下查看进程可以使用的命令:ps命令查找与进程相关的PID号:ps a 显示现行终端机下的所有程序,包括其他用户的程序。ps -A 显示所有程序。 ps aux:ps 命令用于报告当前系统的进程状态。可以搭配kill指令随时中断、删除不必要的程序。 psaux或netstat-tlunpps是进程查看命令 n…

    2024年5月19日
    4100
  • 玫瑰黑客学习视频网站高清的简单介绍

    演员李晨的资料 1、李晨,1978年11月24日出生于北京市,中国内地影视男演员、导演、监制、赛车手,毕业于北京群星艺术学院。1997年,出演个人首部电视剧《十七岁不哭》,从而正式进入演艺圈。1998年,主演警匪剧《刑警本色》。 2、李晨,中国内地演员、监制、赛车手,1978年出生。个人介绍:李晨,1978年生于北京一个军人家庭,中国内地演员、监制、赛车手。…

    2024年5月19日
    4500

发表回复

登录后才能评论



关注微信