Override the Equivalence Comparison in Javascript

后端 未结 5 475
一整个雨季
一整个雨季 2020-11-28 15:55

Is it possible to override the equivalence comparison in Javascript?

The closest I have gotten to a solution is by defining the valueOf function and invoking valueOf

5条回答
  •  时光说笑
    2020-11-28 16:07

    Adding (); may help depending on your requirement.

    var Obj = function (val) {
        this.value = val;
    }();
    

提交回复
热议问题