yep they refer to different contents, what you could do is use the
toString() function of the array to compare both.
[1] == [1] //false
but:
[1].toString == [1].toString() //true
Keep in mind that it just works for arrays, because with normal javascript
objects it wont give you the correct result.
Ex: Object().toString() == Object({a: 1, b: 2}).toString() // true
Fábio Miranda Costa
Engenheiro de Computação
http://meiocodigo.com
On Tue, Jul 7, 2009 at 12:35 PM, rpflo <[email protected]> wrote:
>
> Ah man ...
>
> On Jul 7, 9:14 am, anutron <[email protected]> wrote:
> > [1] != [1]
> >
> > On Tue, Jul 7, 2009 at 8:08 AM, Ryan Florence (via Nabble) <
> > [email protected]<ml-user%[email protected]>
> <ml-user%[email protected]<ml-user%[email protected]>
> >
> >
> >
> >
> >
> >
> > > wrote:
> >
> > > *shouldn't allow* is what I meant.
> >
> > > I even found this
> >
> > > Array.prototype.unique = function () {
> > > var r = new Array();
> > > o:for(var i = 0, n = this.length; i < n; i++)
> > > {
> > > for(var x = 0, y = r.length; x < y; x++)
> > > {
> > > if(r[x]==this[i])
> > > {
> > > continue o;
> > > }
> > > }
> > > r[r.length] = this[i];
> > > }
> > > return r;
> > > }
> >
> > > and gave it a shot and still get the duplicates. Certainly there's
> > > something I'm misunderstanding about arrays.
> >
> > > On Jul 7, 8:58 am, Ryan Florence <rpflore...@...<
> http://n2.nabble.com/user/SendEmail.jtp?type=node&node=3219839&i=0>>
> > > wrote:
> > > > I've got some code that is using include() but it's kicking our
> arrays
> > > > that look like this:
> >
> > > > [[4, 3], [4, 4], [3, 1], [3, 2], [3, 2], [2, 0], [2, 1], [2, 1], [2,
> 1]]
> >
> > > > When I'd expect
> >
> > > > [[4, 3], [4, 4], [3, 1], [3, 2], [2, 0], [2, 1]]
> >
> > > > Any idea why? Here's the code:http://paste.mootools.net/m29973258
> >
> > > ------------------------------
> > > View message @
> > >http://n2.nabble.com/-Moo--arr.include%28%29-should-allow-duplicates%.
> ..
> > > To start a new topic under MooTools Users, email
> > > [email protected]<ml-node%[email protected]>
> <ml-node%[email protected]<ml-node%[email protected]>
> >
> > > To unsubscribe from MooTools Users, click here< (link removed) >.
> >
> > -----
> > The MooTools Tutorial: http://www.mootorial.comwww.mootorial.com
> > Clientcide: http://www.clientcide.comwww.clientcide.com
> > --
> > View this message in context:
> http://n2.nabble.com/-Moo--arr.include%28%29-should-allow-duplicates%...
> > Sent from the MooTools Users mailing list archive at Nabble.com.
>