prototype
is a property of functions. It will not be available on object literals. So, you might want to convert the calc
to a function, like this
function calc() {
this.title = 'Calculator';
}
calc.prototype.plus = function( a, b ) {
console.log(this);
console.log(arguments);
console.log(a+b);
console.log(this.title);
}
Now, you should be able to add the getNum
to the prototype of calc
.