Here's my calculator function:
var MyCalculator = function(c, d) {
this.addition = function(c, d) { return c + d; };
this.multiply = function(c, d) { return d * c; };
this.subtraction = function(c, d) { return c - d; };
this.division = function(c, d) {
if (c/d === Infinity) {
return Infinity - Infinity;
} else return c/d;
};
};
I'm looking to create a functional mixin for 'total' (MyCalculator.total) so that when given values "1,2,3,4", it would output 10 without becoming part of the Calculator property.
Can someone provide instructions on achieving this?