Skip to content

Instantly share code, notes, and snippets.

@psiphi75
Created February 13, 2017 03:55
Show Gist options
  • Save psiphi75/ec7ba8b3a44199373ec6918a5686b4cc to your computer and use it in GitHub Desktop.
Save psiphi75/ec7ba8b3a44199373ec6918a5686b4cc to your computer and use it in GitHub Desktop.
Vector using the classic prototypical object.
function Vector(x, y, z) {
this.x = x;
this.y = y;
this.z = z;
}
Vector.prototype.dot = function(w) {
return this.x * w.x + this.y * w.y + this.z * w.z;
};
// ... more vector functions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment