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


Groups > comp.lang.javascript > #17184

Re: Unique values of array

From Dr J R Stockton <reply1245@merlyn.demon.co.uk.invalid>
Newsgroups comp.lang.javascript
Subject Re: Unique values of array
Date 2012-11-11 16:52 +0000
Organization Home
Message-ID <kN1$Y7G4e9nQFwXN@invalid.uk.co.demon.merlyn.invalid> (permalink)
References <f874a1da-b06c-43af-beb6-fe05c5245469@p22g2000vby.googlegroups.com> <kU7v+sED7UnQFwmG@invalid.uk.co.demon.merlyn.invalid> <f3044be9-979c-448d-94c6-b85acd8ac102@r7g2000vbo.googlegroups.com>

Show all headers | View raw


In comp.lang.javascript message <f3044be9-979c-448d-94c6-b85acd8ac102@r7
g2000vbo.googlegroups.com>, Sat, 10 Nov 2012 09:06:51, Scott Sauyet
<scott.sauyet@gmail.com> posted:

>Dr J R Stockton wrote:
>> Asen Bozhilov posted:
>>
>>> I have seen different approach to find the unique values in array.
>>
>> The answer depends on what you mean by "find".  If the array A is
>>    ["a", "b", "a"]    is the answer 2, the location of the (only) unique
>> item, or is it "b", the value of the item?
>
>The performance test link Asen supplied [1] makes it clear that what
>he's looking for is, in this case, ["a", "b"], although quite possibly
>the order of the resulting array wouldn't matter.  In other words,
>he's not looking for the values which appear only once in the input
>but rather one copy of each (possibly multiply occurring) value in the
>input.


The same approach works for that.  Fill the new object as before, and
read out all of its elements.  I fill objects in that fashion in my
<http://www.merlyn.demon.co.uk/linxchek.htm>, frequently used, and read
them in various ways, including   for (X in Object) { ... }.

-- 
(c) John Stockton, nr London UK. Mail, see homepage.  DOS 3.3, 6.20; WinXP, 7.
   Web  <http://www.merlyn.demon.co.uk/> - FAQqish topics, acronyms & links.
   PAS EXE TXT ZIP via  <http://www.merlyn.demon.co.uk/programs/00index.htm>
   My DOS  <http://www.merlyn.demon.co.uk/batfiles.htm> - also batprogs.htm.

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