Hallo Murphy,
Die Funktion, die Du gepostet hast, produziert zwar das gleiche Resultat wie meine, ist aber wesentlich ineffizienter, da sie statt Hashlookups lineare Scans verwendet [1].
Ja, dein Algorithmus ist in der Tat wesentlich besser. Dann werde ich meinen gleich mal verbessern. :-)
Ob man die Funktion lieber extern oder lieber am Prototypen von Arrays verankert haben möchte ist wohl Geschmackssache. Tauscht man in meiner Funktion 'ain' durch 'this' aus und weist sie Array.prototype.unique zu, so kann man sie auch als Methode verwenden.
Ich finde prototyping halt genial (habe es erst vor einigen Tagen zum ersten Mal verwendet und bin begeistert).
Grüße
Marc Reichelt || http://www.marcreichelt.de/
--
panic("Oh boy, that early out of memory?");
linux-2.2.16/arch/mips/mm/init.c
Selfcode: ie:{ fl:| br:> va:} ls:< fo:} rl:( n4:( ss:) de:> js:| ch:? sh:| mo:) zu:)
panic("Oh boy, that early out of memory?");
linux-2.2.16/arch/mips/mm/init.c
Selfcode: ie:{ fl:| br:> va:} ls:< fo:} rl:( n4:( ss:) de:> js:| ch:? sh:| mo:) zu:)