Revealing Proptotype Pattern
by toby3105
HTML
<div id="output"></div>
JavaScript
var Calculator = function (eq){
this.eqCtl = document.getElementById(eq);
};
Calculator.prototype = function(){
var add = function(x,y){
this.eqCtl.innerHTML = x+y;
};
return{
add:add
};
}();
var calc = new Calculator("output");
console.log("call")
calc.add(2,5);