Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #17088

Re: Unique values of array

Message-ID <1626786.ztarQMnBzF@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Organization PointedEars Software (PES)
Date 2012-11-08 21:21 +0100
Subject Re: Unique values of array
Newsgroups comp.lang.javascript
References <f874a1da-b06c-43af-beb6-fe05c5245469@p22g2000vby.googlegroups.com>
Followup-To comp.lang.javascript

Followups directed to: comp.lang.javascript

Show all headers | View raw


Asen Bozhilov wrote:

> I have seen different approach to find the unique values in array.
> ECMAScript6 will come with Set constructor and this would be easy to
> achieve.

That would be good.  Reference?

> The problem is how optimal are the current JS solutions for
> unique values. The naive approach would be, to build a hash map when
> keys are the values of the array. The problem is that there is no
> built-in Map and the keys are always string. This is not applicable
> when array contains different types and especially objects.

So you need a Map that can have objects as keys.

<http://PointedEars.de/scripts/map.js>
<http://PointedEars.de/scripts/test/map>


PointedEars
-- 
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
  -- Richard Cornford, cljs, <f806at$ail$1$8300dec7@news.demon.co.uk>

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Unique values of array Asen Bozhilov <asen.bozhilov@gmail.com> - 2012-11-08 05:00 -0800
  Re: Unique values of array Scott Sauyet <scott.sauyet@gmail.com> - 2012-11-08 06:10 -0800
    Re: Unique values of array Asen Bozhilov <asen.bozhilov@gmail.com> - 2012-11-08 06:26 -0800
  Re: Unique values of array Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-11-08 21:21 +0100
    Re: Unique values of array Asen Bozhilov <asen.bozhilov@gmail.com> - 2012-11-08 13:06 -0800
      Re: Unique values of array Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-11-09 02:26 +0100
  Re: Unique values of array Dr J R Stockton <reply1245@merlyn.demon.co.uk.invalid> - 2012-11-09 18:43 +0000
    Re: Unique values of array Scott Sauyet <scott.sauyet@gmail.com> - 2012-11-10 09:06 -0800
      Re: Unique values of array "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2012-11-10 20:19 +0100
        Re: Unique values of array "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2012-11-10 20:26 +0100
        Re: Unique values of array Scott Sauyet <scott.sauyet@gmail.com> - 2012-11-11 08:47 -0800
      Re: Unique values of array Dr J R Stockton <reply1245@merlyn.demon.co.uk.invalid> - 2012-11-11 16:52 +0000
        Re: Unique values of array Scott Sauyet <scott.sauyet@gmail.com> - 2012-11-12 05:10 -0800
          Re: Unique values of array Dr J R Stockton <reply1246@merlyn.demon.co.uk.invalid> - 2012-11-13 16:39 +0000
            Re: Unique values of array "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2012-11-14 10:21 +0100
            Re: Unique values of array Scott Sauyet <scott.sauyet@gmail.com> - 2012-11-14 04:32 -0800

csiph-web