ViliusCreator (2019-01-18T18:31:52.000Z)
viliuskubilius416 at gmail.com (2019-01-18T18:36:25.348Z)
What about having Symbol.equals? For example, for now this is what it does: ```js class Position { constructor(o) { this.x = o.x instanceof Number ? o.x : 0 this.y = o.y instanceof Number ? o.y : 0 this.z = o.z instanceof Number ? o.z : 0 } } console.log(new Position({x: 10, y: 10, z: 10}) === new Position({x: 10, y: 10, z: 10}) ``` Output is of course, false. With `Symbol.equals`, we could make it easier, instead of `instance.equals(otherInstance)`. For example: ```js class Position { [Symbol.equals](oIn) { return oIn.x === this.x && oIn.y === this.y && oIn.z === this.z } constructor(o) { this.x = o.x instanceof Number ? o.x : 0 this.y = o.y instanceof Number ? o.y : 0 this.z = o.z instanceof Number ? o.z : 0 } } console.log(new Position({x: 10, y: 10, z: 10}) === new Position({x: 10, y: 10, z: 10}) ``` Now output would be true. This would save most of the time, instead of writing .equals and then surrounding everything with ().