Object Comparison
JavaScript
function Point(x, y) {
this.x = 0;
this.y = 0;
this.xIsGreaterThan = function(newPoint) {
return (this.x > newPoint.x);
};
this.xIsEqual = function(newPoint) {
return (this.x === newPoint.x);
};
}
var p1 = new Point();
var p2 = new Point();
p1.x = 10;
console.log(p1.xIsGreaterThan(p2));
console.log(p1.xIsEqual(p2));