Array inner Product - Node.js Array

Node.js examples for Array:Set Operation

Description

Array inner Product

Demo Code

Array.prototype.innerProduct = function(other) {
  if (arguments.length == 3) return this[0]*arguments[0] + this[1]*arguments[1] + this[2]*arguments[2];
  return (this[0]*other[0] + this[1]*other[1] + this[2]*other[2]);
};

Related Tutorials