JavaScript

Functions as Methods

var calculator = {
        operand1: 1,
        operand2: 3,
        compute: function () {
                this.result = this.operand1 + this.operand2;
        }
};
calculator.compute();

calculator.result

José M. Vidal .

42 of 65