Решение:
var Calculator = function (eq) { this.eqCtl = document.getElementById(eq); }; // using JSON Calculator.prototype = { add: function (x, y) { var val = x + y; this.eqCtl.innerHTML = val; }, sub: function (x, y) { var val = x - y; this.eqCtl.innerHTML = val; } } $(function () { var c = new Calculator("eq"); c.sub(2,4); });