yep, I'm afraid this is described as such in the old post (and in specs)
too:

> Return true if x and y refer to the same object. Otherwise, return false

in your Point cases you can add `.equals(otherPoint)` in Point prototype
otherwise use an utility that does similar thing Java does.

Regards



On Sun, Jan 4, 2015 at 3:16 AM, Michał Wadas <[email protected]> wrote:

> It won't help because objects are ALWAYS compared by their identity.
> valeOf or toString will be used only in case of comparing object with
> primitive.
> 4 sty 2015 03:10 "Salvador de la Puente González" <[email protected]>
> napisał(a):
>
> Reimplement Object#valueOf() returning a string representation of your
>> object.
>>
>> See
>> http://webreflection.blogspot.com.es/2010/10/javascript-coercion-demystified.html?m=1
>>
>> Hope it helps.
>> On 4 Jan 2015 02:53, "Soni L." <[email protected]> wrote:
>>
>>>  I've been looking and looking and looking and I couldn't find a way to
>>> override == to make 2 different instances of MyPoint compare == if they
>>> have the same coordinates. (I guess this also applies to String objects
>>> and stuff but I haven't tested that)
>>>
>>> So how do I do this?
>>>
>>> (PS: yes, I know, Java has an .equals method, not overridable ==, but
>>> it's basically the same thing)
>>>
>>> _______________________________________________
>>> es-discuss mailing list
>>> [email protected]
>>> https://mail.mozilla.org/listinfo/es-discuss
>>>
>>>
>> _______________________________________________
>> es-discuss mailing list
>> [email protected]
>> https://mail.mozilla.org/listinfo/es-discuss
>>
>>
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
>
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to