// Constructor Function
function Complex(real, imaginary) {
this.x = real;
this.y = imaginary;
}
// Instance methods
Complex.prototype.magnitude = function() {
return Math.sqrt(this.x*this.x + this.y*this.y);
};
Complex.prototype.negative = function() {
return new Complex(-this.x, -this.y);
};
// Continue on
Complex.ZERO = new Complex(0,0);
Complex.ONE = new Complex(1,0);
Complex.I = new Complex(0,1);