Overriding the == operator, like in Java/Lua/Python/whatever.

Salvador de la Puente González salva at unoyunodiez.com
Sat Jan 3 18:10:15 PST 2015


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." <fakedme+es at gmail.com> 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
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150104/6122c2ff/attachment.html>


More information about the es-discuss mailing list