Read more

Array.uniq does not work in Prototype

Tobias Kraze
August 25, 2010Software engineer at makandra GmbH

For arrays of objects, uniq does not work as expected, since it uses strict equality. So

[[1], [1]].uniq() == [[1], [1]]
Illustration UI/UX Design

UI/UX Design by makandra brand

We make sure that your target audience has the best possible experience with your digital product. You get:

  • Design tailored to your audience
  • Proven processes customized to your needs
  • An expert team of experienced designers
Read more Show archive.org snapshot

In some cases, this might be a workaround:

[[1], [1]].invoke("toJSON").uniq().invoke("evalJSON")   
// == [[1]]
Posted by Tobias Kraze to makandra dev (2010-08-25 15:22)